Skip to content

Commit

Permalink
Merge branch 'libcsp:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Apaisal authored Sep 10, 2024
2 parents 62b8f20 + cc71d1a commit 6ba9cd9
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/csp_qfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

static csp_static_queue_t qfifo_queue __noinit;
static csp_queue_handle_t qfifo_queue_handle __noinit;
char qfifo_queue_buffer[sizeof(csp_qfifo_t) * CSP_QFIFO_LEN] __noinit;
static char qfifo_queue_buffer[sizeof(csp_qfifo_t) * CSP_QFIFO_LEN] __noinit;

void csp_qfifo_init(void) {
qfifo_queue_handle = csp_queue_create_static(CSP_QFIFO_LEN, sizeof(csp_qfifo_t), qfifo_queue_buffer, &qfifo_queue);
Expand Down
2 changes: 0 additions & 2 deletions src/csp_rdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ int csp_rdp_connect(csp_conn_t * conn);
int csp_rdp_close(csp_conn_t * conn, uint8_t closed_by);
int csp_rdp_send(csp_conn_t * conn, csp_packet_t * packet);
int csp_rdp_check_ack(csp_conn_t * conn);

void csp_rdp_conn_print(csp_conn_t * conn);
6 changes: 3 additions & 3 deletions src/csp_rdp_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

static int __csp_rdp_queue_flush(csp_queue_handle_t queue, csp_conn_t * conn) {

int ret;
int ret = CSP_ERR_NONE;
int size;

size = csp_queue_size(queue);
Expand Down Expand Up @@ -85,8 +85,8 @@ void csp_rdp_queue_flush(csp_conn_t * conn) {
csp_queue_empty(tx_queue);
csp_queue_empty(rx_queue);
} else {
(void)__csp_rdp_queue_flush(conn, tx_queue);
(void)__csp_rdp_queue_flush(conn, rx_queue);
(void)__csp_rdp_queue_flush(tx_queue, conn);
(void)__csp_rdp_queue_flush(rx_queue, conn);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/csp_yaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void csp_yaml_init(char * filename, unsigned int * dfl_addr) {
csp_print(" Reading config from %s\n", filename);
FILE * file = fopen(filename, "rb");
if (file == NULL) {
printf(" ERROR: failed to find CSP config file\n");
csp_print(" ERROR: failed to find CSP config file\n");
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_sources(csp PRIVATE usart/usart_linux.c)
target_sources(csp PRIVATE eth/eth_linux.c)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Zephyr")
target_sources(csp PRIVATE usart/usart_zephyr.c)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/can/can_socketcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void * socketcan_rx_thread(void * arg) {
timeout.tv_sec = 10;
int n = select(ctx->socket + 1, &input, NULL, NULL, &timeout);
if (n == -1) {
printf("CAN read error\n");
csp_print("CAN read error\n");
continue;
} else if (n == 0) {
//printf("CAN idle\n");
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/eth/eth_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int csp_eth_init(const char * device, const char * ifname, int mtu, unsigned int
/* Open RAW socket to send on */
if ((ctx->sockfd = socket(AF_PACKET, SOCK_RAW, htobe16(CSP_ETH_TYPE_CSP))) == -1) {
perror("socket");
printf("Use command 'setcap cap_net_raw+ep ./csh'\n");
csp_print("Use command 'setcap cap_net_raw+ep ./csh'\n");
return CSP_ERR_INVAL;
}

Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ target_sources(csp PRIVATE
csp_if_tun.c
csp_if_can.c
csp_if_can_pbuf.c
csp_if_eth.c
csp_if_eth_pbuf.c
)

if(LIBZMQ_FOUND)
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/csp_if_eth_pbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ void csp_if_eth_pbuf_list_cleanup(csp_packet_t ** plist) {
void csp_if_eth_pbuf_print(const char * descr, csp_packet_t * packet) {

if (packet) {
printf("%s %p id:%u Age:%lu,%lu,%lu flen:%u\n",
csp_print("%s %p id:%u Age:%lu,%lu,%lu flen:%u\n",
descr, (void *)packet,
(unsigned)packet->cfpid,
(unsigned long)csp_get_ms(),
(unsigned long)packet->last_used,
(unsigned long)(csp_get_ms() - packet->last_used),
(unsigned)packet->frame_length);
} else {
printf("Packet is null\n");
csp_print("Packet is null\n");
}

}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/csp_if_kiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void csp_kiss_rx(csp_iface_t * iface, const uint8_t * buf, size_t len, void * px
/* If no more memory, skip frame */
if (ifdata->rx_packet == NULL) {
ifdata->rx_mode = KISS_MODE_SKIP_FRAME;
iface->drop++;
break;
}

Expand Down
12 changes: 6 additions & 6 deletions src/interfaces/csp_if_zmqhub.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ int csp_zmqhub_init_w_name_endpoints_rxfilter(const char * ifname, uint16_t addr
assert(ret == 0);

/* Register interface */
csp_iflist_add(&drv->iface);
ret = csp_iflist_add(&drv->iface);

if (return_interface) {
if (ret == CSP_ERR_NONE && return_interface) {
*return_interface = &drv->iface;
}

return CSP_ERR_NONE;
return ret;
}

int csp_zmqhub_init_filter2(const char * ifname, const char * host, uint16_t addr, uint16_t netmask, int promisc, csp_iface_t ** return_interface, char * sec_key, uint16_t subport, uint16_t pubport) {
Expand Down Expand Up @@ -312,13 +312,13 @@ int csp_zmqhub_init_filter2(const char * ifname, const char * host, uint16_t add
assert(ret == 0);

/* Register interface */
csp_iflist_add(&drv->iface);
ret = csp_iflist_add(&drv->iface);

if (return_interface) {
if (ret == CSP_ERR_NONE && return_interface) {
*return_interface = &drv->iface;
}

return CSP_ERR_NONE;
return ret;
}


Expand Down

0 comments on commit 6ba9cd9

Please sign in to comment.