File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
libraries/lwIP_Ethernet/src Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -825,13 +825,12 @@ extern "C" {
825825 return __real_ethernet_input (p, netif);
826826 }
827827
828- void lwip_callback (void (*cb)(void *), void *cbData, void *buffer) {
828+ void lwip_callback (void (*cb)(void *), void *cbData, __callback_req *buffer) {
829829#ifdef __FREERTOS
830830 if (buffer) {
831- __callback_req *req = (__callback_req *)buffer;
832- req->cb = cb;
833- req->cbData = cbData;
834- __lwip (__callback, req, true );
831+ buffer->cb = cb;
832+ buffer->cbData = cbData;
833+ __lwip (__callback, buffer, true );
835834 return ;
836835 } else if (!__isLWIPThread ()) {
837836 __callback_req req = { cb, cbData };
Original file line number Diff line number Diff line change @@ -569,14 +569,12 @@ typedef struct {
569569} __ethernet_input_req;
570570
571571// Run a callback in the LWIP thread (i.e. for Ethernet device polling and packet reception)
572- // When in an interrupt, need to pass in a heap-allocated buffer (i.e. class variable) of
573- // size LWIP_CALLBACK_BUFFER_SIZE that will be used to store the request.
574- extern void lwip_callback (void (*cb)(void *), void *cbData, void *buffer = nullptr);
572+ // When in an interrupt, need to pass in a heap-allocated buffer
575573typedef struct {
576574 void (*cb)(void *);
577575 void *cbData;
578576} __callback_req;
579- # define LWIP_CALLBACK_BUFFER_SIZE sizeof ( __callback_req)
577+ extern void lwip_callback ( void (*cb)( void *), void *cbData, __callback_req *buffer = nullptr);
580578
581579#ifdef __cplusplus
582580};
Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ class LwipIntfDev: public LwipIntf, public RawDev {
194194 err_t handlePackets ();
195195#ifdef __FREERTOS
196196 SemaphoreHandle_t _hwMutex;
197+ __callback_req _irqBuffer;
197198#endif
198- uint8_t _irqBuffer[LWIP_CALLBACK_BUFFER_SIZE] __attribute__ ((aligned (4 )));;
199199protected:
200200 // members
201201 SPIClass& _spiUnit;
@@ -490,7 +490,7 @@ template<class RawDev>
490490void LwipIntfDev<RawDev>::_irq(void *param) {
491491 LwipIntfDev *d = static_cast <LwipIntfDev*>(param);
492492 ethernet_arch_lwip_gpio_mask (); // Disable other IRQs until we're done processing this one
493- lwip_callback (_lwipCallback, param, ( void *) d->_irqBuffer );
493+ lwip_callback (_lwipCallback, param, & d->_irqBuffer );
494494 // ethernet_arch_lwip_begin();
495495 // d->handlePackets();
496496 // sys_check_timeouts();
You can’t perform that action at this time.
0 commit comments