mirror of
https://github.com/thead-yocto-mirror/process-linker
synced 2026-07-13 11:46:36 +02:00
Compare commits
4 Commits
Linux_SDK_
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af485b58f | ||
|
|
ee655750f9 | ||
|
|
3d0966dbf7 | ||
|
|
1871068c7e |
@@ -19,12 +19,16 @@
|
|||||||
#ifndef _PROCESS_LINKER_H_
|
#ifndef _PROCESS_LINKER_H_
|
||||||
#define _PROCESS_LINKER_H_
|
#define _PROCESS_LINKER_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PLINK_VERSION_MAJOR 0
|
#define PLINK_VERSION_MAJOR 0
|
||||||
#define PLINK_VERSION_MINOR 1
|
#define PLINK_VERSION_MINOR 1
|
||||||
#define PLINK_VERSION_REVISION 1
|
#define PLINK_VERSION_REVISION 1
|
||||||
|
|
||||||
/* Maximum data descriptors in one packet */
|
/* Maximum data descriptors in one packet */
|
||||||
#define PLINK_MAX_DATA_DESCS 4
|
#define PLINK_MAX_DATA_DESCS 10
|
||||||
|
|
||||||
/* Close all the connections from client. */
|
/* Close all the connections from client. */
|
||||||
/* Can be used as the second parameter of PLINK_close when the instance is created as SERVER */
|
/* Can be used as the second parameter of PLINK_close when the instance is created as SERVER */
|
||||||
@@ -214,4 +218,8 @@ PlinkStatus PLINK_recv_ex(PlinkHandle plink, PlinkChannelID channel, PlinkPacket
|
|||||||
*/
|
*/
|
||||||
PlinkStatus PLINK_close(PlinkHandle plink, PlinkChannelID channel);
|
PlinkStatus PLINK_close(PlinkHandle plink, PlinkChannelID channel);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !_PROCESS_LINKER_H_ */
|
#endif /* !_PROCESS_LINKER_H_ */
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
#include "process_linker.h"
|
#include "process_linker.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* When set PlinkMsg.msg to this exit code, it means to close the connection */
|
/* When set PlinkMsg.msg to this exit code, it means to close the connection */
|
||||||
#define PLINK_EXIT_CODE -1
|
#define PLINK_EXIT_CODE -1
|
||||||
|
|
||||||
@@ -185,4 +189,8 @@ typedef struct _PlinkTimeInfo
|
|||||||
long long useconds;
|
long long useconds;
|
||||||
} PlinkTimeInfo;
|
} PlinkTimeInfo;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !_PROCESS_LINKER_TYPES_H_ */
|
#endif /* !_PROCESS_LINKER_TYPES_H_ */
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ typedef struct _PlinkContext
|
|||||||
{
|
{
|
||||||
PlinkMode mode;
|
PlinkMode mode;
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
struct iovec io[PLINK_MAX_DATA_DESCS];
|
struct iovec ioIn[PLINK_MAX_DATA_DESCS];
|
||||||
|
struct iovec ioOut[PLINK_MAX_DATA_DESCS];
|
||||||
int sockfd;
|
int sockfd;
|
||||||
int cfd[MAX_CONNECTIONS];
|
int cfd[MAX_CONNECTIONS];
|
||||||
int connect[MAX_CONNECTIONS];
|
int connect[MAX_CONNECTIONS];
|
||||||
@@ -228,13 +229,13 @@ PLINK_send(PlinkHandle plink, PlinkChannelID channel, PlinkPacket *pkt)
|
|||||||
for (int i = 0; i < pkt->num; i++)
|
for (int i = 0; i < pkt->num; i++)
|
||||||
{
|
{
|
||||||
PlinkDescHdr *hdr = (PlinkDescHdr *)(pkt->list[i]);
|
PlinkDescHdr *hdr = (PlinkDescHdr *)(pkt->list[i]);
|
||||||
ctx->io[i].iov_base = pkt->list[i];
|
ctx->ioOut[i].iov_base = pkt->list[i];
|
||||||
ctx->io[i].iov_len = hdr->size + DATA_HEADER_SIZE;
|
ctx->ioOut[i].iov_len = hdr->size + DATA_HEADER_SIZE;
|
||||||
PLINK_PRINT(INFO, "Sending %ld bytes\n", ctx->io[i].iov_len);
|
PLINK_PRINT(INFO, "Sending Out %ld bytes\n", ctx->ioOut[i].iov_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct msghdr msg = {0};
|
struct msghdr msg = {0};
|
||||||
msg.msg_iov = ctx->io;
|
msg.msg_iov = ctx->ioOut;
|
||||||
msg.msg_iovlen = pkt->num;
|
msg.msg_iovlen = pkt->num;
|
||||||
|
|
||||||
if (pkt->fd > PLINK_INVALID_FD)
|
if (pkt->fd > PLINK_INVALID_FD)
|
||||||
@@ -273,11 +274,11 @@ PLINK_recv(PlinkHandle plink, PlinkChannelID channel, PlinkPacket *pkt)
|
|||||||
|
|
||||||
char buf[CMSG_SPACE(sizeof(int))];
|
char buf[CMSG_SPACE(sizeof(int))];
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
ctx->io[0].iov_base = ctx->buffer + ctx->offset;
|
ctx->ioIn[0].iov_base = ctx->buffer + ctx->offset;
|
||||||
ctx->io[0].iov_len = MAX_BUFFER_SIZE - ctx->offset;
|
ctx->ioIn[0].iov_len = MAX_BUFFER_SIZE - ctx->offset;
|
||||||
|
|
||||||
struct msghdr msg = {0};
|
struct msghdr msg = {0};
|
||||||
msg.msg_iov = ctx->io;
|
msg.msg_iov = ctx->ioIn;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
msg.msg_control = buf;
|
msg.msg_control = buf;
|
||||||
msg.msg_controllen = sizeof(buf);
|
msg.msg_controllen = sizeof(buf);
|
||||||
@@ -477,6 +478,8 @@ parseData(PlinkContext *ctx, PlinkPacket *pkt, int remaining)
|
|||||||
{
|
{
|
||||||
// not enough buffer to store received data, need another recv call
|
// not enough buffer to store received data, need another recv call
|
||||||
sts = PLINK_STATUS_MORE_DATA;
|
sts = PLINK_STATUS_MORE_DATA;
|
||||||
|
PLINK_PRINT(ERROR, "sts:%d Received %d bytes,index exceed max:%d!\n",
|
||||||
|
sts, remaining, PLINK_MAX_DATA_DESCS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ static int stitchOneFrame(StitcherContext *ctx)
|
|||||||
in->format == PLINK_COLOR_FormatRawBayer10bit ||
|
in->format == PLINK_COLOR_FormatRawBayer10bit ||
|
||||||
in->format == PLINK_COLOR_FormatRawBayer12bit)
|
in->format == PLINK_COLOR_FormatRawBayer12bit)
|
||||||
{
|
{
|
||||||
int shift = in->format == PLINK_COLOR_FormatYUV420SemiPlanarP010 ? 2 : 8;
|
int shift = in->format == PLINK_COLOR_FormatYUV420SemiPlanarP010 ? 2 : 4;
|
||||||
unsigned int temp[4];
|
unsigned int temp[4];
|
||||||
for (int h = 0; h < height; h++)
|
for (int h = 0; h < height; h++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user