From 0e88dd896eae11d11c3cd6160aff1cf20e22ba23 Mon Sep 17 00:00:00 2001 From: Epagris Date: Sat, 21 Jun 2025 09:44:53 +0200 Subject: [PATCH] - upgraded to GCC14 --- Inc/flexptp_options.h | 5 +++-- Inc/lwipopts.h | 4 ++++ Modules/lwip_port/tiva-tm4c129/sys_arch.c | 26 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Inc/flexptp_options.h b/Inc/flexptp_options.h index df48d63..d0f94a0 100644 --- a/Inc/flexptp_options.h +++ b/Inc/flexptp_options.h @@ -1,8 +1,6 @@ #ifndef FLEXPTP_OPTIONS_CH32F207_H_ #define FLEXPTP_OPTIONS_CH32F207_H_ -#define ETHLIB - // ------------------------------------------- // ------ DEFINES FOR FLEXPTP SETTINGS ------- // ------------------------------------------- @@ -24,6 +22,7 @@ #include "cli.h" #include "utils.h" +#include "embfmt/embformat.h" #define FLEXPTP_SNPRINTF(...) embfmt(__VA_ARGS__) @@ -41,6 +40,8 @@ #include "inc/hw_memmap.h" #include "driverlib/emac.h" +#include "flexptp/port/example_ports/ptp_port_tiva_tm4c1294.h" + #define PTP_HW_INIT(increment, addend) ptphw_init(increment, addend) #define PTP_UPDATE_CLOCK(s,ns) EMACTimestampSysTimeUpdate(EMAC0_BASE, labs(s), abs(ns), (s * NANO_PREFIX + ns) < 0) #define PTP_SET_CLOCK(s, ns) EMACTimestampSysTimeSet(EMAC0_BASE, s, ns) diff --git a/Inc/lwipopts.h b/Inc/lwipopts.h index e3d5609..425ceb1 100644 --- a/Inc/lwipopts.h +++ b/Inc/lwipopts.h @@ -35,6 +35,7 @@ #define __LWIPOPTS_H__ #include +#include #include /** @@ -103,6 +104,9 @@ a lot of data that needs to be copied, this should be set high. */ /* --------- Ethernet hooks --------- */ +struct netif; +struct pbuf; +extern int8_t hook_unknown_ethertype(struct pbuf *pbuf, struct netif *netif); #define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf,netif) hook_unknown_ethertype(pbuf,netif) /* ---------- IPv4 options ---------- */ diff --git a/Modules/lwip_port/tiva-tm4c129/sys_arch.c b/Modules/lwip_port/tiva-tm4c129/sys_arch.c index d825683..6e7db0d 100644 --- a/Modules/lwip_port/tiva-tm4c129/sys_arch.c +++ b/Modules/lwip_port/tiva-tm4c129/sys_arch.c @@ -41,6 +41,7 @@ /* lwIP includes. */ #include "lwip/opt.h" #include "lwip/sys.h" +#include "lwip/mem.h" #if NO_SYS @@ -395,6 +396,31 @@ sys_mbox_trypost(sys_mbox_t *mbox, void *msg) return ERR_MEM; } +/** + * Tries to send a message to a mailbox. + * + * @param mbox is the mailbox + * @param msg is the message to send + * @return ERR_OK if the message was sent and ERR_MEM if there was no space for + * the message + */ +err_t +sys_mbox_trypost_fromisr(sys_mbox_t *mbox, void *msg) +{ + /* Send this message to the queue. */ + if(xQueueSendFromISR(mbox->queue, &msg, 0) == pdPASS) { + return ERR_OK; + } + + /* Update the mailbox statistics. */ +#if SYS_STATS + STATS_INC(sys.mbox.err); +#endif /* SYS_STATS */ + + /* The message could not be sent. */ + return ERR_MEM; +} + /** * Retrieve a message from a mailbox. *