From e83c47b041130de3771cdaef801676df72f76021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiesner=20Andr=C3=A1s?= Date: Sat, 28 Oct 2023 07:40:07 +0200 Subject: [PATCH] - include chaos fixed (partially) - EthInterface's IODef callback signatures fixed --- eth_interface.c | 10 +++++----- eth_interface.h | 7 ++++--- msg_queue.h | 2 +- prefab/packet_parsers/dhcp.h | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/eth_interface.c b/eth_interface.c index ea24b42..46078f8 100644 --- a/eth_interface.c +++ b/eth_interface.c @@ -42,7 +42,7 @@ static void ethintf_register(EthInterface * intf) { } // interface processing thread -static void task_ethinf(const void * param); +static ETHLIB_OS_THREAD_FUNCTION(task_ethintf); EthInterface *ethintf_new(EthIODef * io) { EthInterface * ethIntf = (EthInterface *)dynmem_alloc(sizeof(EthInterface)); @@ -59,8 +59,8 @@ EthInterface *ethintf_new(EthIODef * io) { ethIntf->txQ = mq_create(ETHLIB_DEF_MQ_SIZE); ethIntf->rxQ = mq_create(ETHLIB_DEF_MQ_SIZE); ETHLIB_OS_SEM_CREATE(ðIntf->rxSem, ETHLIB_DEF_MQ_SIZE); - ETHLIB_OS_THREAD_DEFINE(task_ethinf, osPriorityHigh, 512, ethIntf); - ETHLIB_OS_THREAD_CREATE(task_ethinf, ethIntf); + ETHLIB_OS_THREAD_DEFINE(task_ethintf, osPriorityHigh, 512, ethIntf); + ETHLIB_OS_THREAD_CREATE(task_ethintf, ethIntf); ethIntf->ipra = ipra_new(); @@ -75,11 +75,11 @@ EthInterface *ethintf_new(EthIODef * io) { return ethIntf; } -static void task_ethinf(const void * param) { +static ETHLIB_OS_THREAD_FUNCTION(task_ethintf) { EthInterface * intf = (EthInterface *) param; while (true) { ETHLIB_OS_SEM_WAIT(&intf->rxSem); - intf->ioDef->llRxRead(intf->ioDef, intf->rxQ); // read packets + intf->ioDef->llRxRead(intf->ioDef); // read packets, will invoke RxStore while (mq_avail(intf->rxQ) > 0) { RawPckt rawPckt = mq_top(intf->rxQ); mq_pop(intf->rxQ); diff --git a/eth_interface.h b/eth_interface.h index 14ade9e..39d5d97 100644 --- a/eth_interface.h +++ b/eth_interface.h @@ -10,8 +10,9 @@ #include "connection_block.h" #include "msg_queue.h" #include "prefab/conn_blocks/ipv4/ip_assembler.h" -#include "etherlib_options.h" -#include "etherlib/prefab/packet_parsers/dhcp.h" +#include "prefab/packet_parsers/dhcp.h" + +#include /** * Ethernet interface low level definition. @@ -22,7 +23,7 @@ typedef struct EthIODef_ { int (*llLinkChg)(struct EthIODef_ * io, int linkState); ///< Link change interrupt int (*llRxStore)(struct EthIODef_ * io, const RawPckt * rawPckt); ///< Receive done callback int (*llError)(struct EthIODef_ * io, int error); ///< Low-level error interrupt - int (*llRxRead)(struct EthIODef_ * io, MsgQueue * mq); ///< Read received packets + int (*llRxRead)(struct EthIODef_ * io); ///< Read received packets int (*llRxNotify)(struct EthIODef_ * io); ///< Notify of received packets void * tag; ///< Some arbitrary tagging diff --git a/msg_queue.h b/msg_queue.h index 448db26..b049f61 100644 --- a/msg_queue.h +++ b/msg_queue.h @@ -5,7 +5,7 @@ #include #include "packet.h" -typedef struct { +typedef struct MsgQueue_ { uint32_t writeIdx; ///< Next block to write uint32_t readIdx; ///< Next block to read uint32_t size; ///< Size of circular buffer diff --git a/prefab/packet_parsers/dhcp.h b/prefab/packet_parsers/dhcp.h index b2f8c87..5f1128a 100644 --- a/prefab/packet_parsers/dhcp.h +++ b/prefab/packet_parsers/dhcp.h @@ -3,8 +3,8 @@ #include //#include "../../eth_interface.h" -#include "etherlib/cbd_table.h" -#include "etherlib_options.h" +#include "../../cbd_table.h" +#include typedef struct { uint8_t op; ///< Operations