From 0803fc519ad7227e841287fb3638d6c8b2f111a1 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 25 Apr 2022 21:16:18 +1000 Subject: [PATCH] w5200: Allow selecting maximum fixed buffer size for MACRAW. Enabling WIZCHIP_USE_MAX_BUFFER will make the TX/RX buffers the maximum available size, for use with MACRAW mode. Adapted from original version by @dpgeorge at: https://github.com/micropython/micropython/commit/cd9de63c0e8ac242148c87869d37dcc295c7497a --- Ethernet/W5200/w5200.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Ethernet/W5200/w5200.c b/Ethernet/W5200/w5200.c index 52bd5f5..60f2e98 100644 --- a/Ethernet/W5200/w5200.c +++ b/Ethernet/W5200/w5200.c @@ -41,6 +41,23 @@ #include "w5200.h" #if (_WIZCHIP_ == 5200) + +#if WIZCHIP_USE_MAX_BUFFER +// This option is intended to be used when MACRAW mode is enabled, to allow +// the single raw socket to use all the available buffer space. +#undef getSn_TxMASK +#define getSn_TxMASK(sn) (16 * 1024 - 1) /* tx buffer mask */ + +#undef getSn_TxMAX +#define getSn_TxMAX(sn) (16 * 1024) /* max tx buffer size */ + +#undef getSn_RxMASK +#define getSn_RxMASK(sn) (16 * 1024 - 1) /* rx buffer mask */ + +#undef getSn_RxMAX +#define getSn_RxMAX(sn) (16 * 1024) /* max rx buffer size */ +#endif + /** @brief This function writes the data into W5200 registers. */