- include chaos fixed (partially)

- EthInterface's IODef callback signatures fixed
This commit is contained in:
Wiesner András 2023-10-28 07:40:07 +02:00
parent 0add109430
commit e83c47b041
4 changed files with 12 additions and 11 deletions

View File

@ -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(&ethIntf->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);

View File

@ -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 <etherlib_options.h>
/**
* 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

View File

@ -5,7 +5,7 @@
#include <stdint.h>
#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

View File

@ -3,8 +3,8 @@
#include <stdint.h>
//#include "../../eth_interface.h"
#include "etherlib/cbd_table.h"
#include "etherlib_options.h"
#include "../../cbd_table.h"
#include <etherlib_options.h>
typedef struct {
uint8_t op; ///< Operations