]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
sysless/lpc17xx: option to allocate descriptors and buffers from specified section.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 16 Sep 2015 22:29:53 +0000 (00:29 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 27 Jul 2016 18:55:44 +0000 (20:55 +0200)
Specification of .usbram section matches lpc17xx and lpc178x
sysless boards configurations.

  CONFIG_EMAC_DESC_SECTION=".usbram"

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ports/driver/lpc_emac/Makefile.omk
ports/driver/lpc_emac/lpc17xx_netif.c

index 50a31d4c1fbbd5ece4b7a551ab16de6f6d767973..66c8f54856207cb0860205fe08f3592b440a20f3 100644 (file)
@@ -10,6 +10,10 @@ emac_config_DEFINES += CONFIG_EMAC_ETH_FRAME_SIZE
 emac_config_DEFINES += CONFIG_EMAC_NUM_RX_FRAGS
 # number of EMAC TX fragments (def. 2 -> Tx 3kB )
 emac_config_DEFINES += CONFIG_EMAC_NUM_TX_FRAGS
+
+# specify memory section for descriptors allocation
+emac_config_DEFINES += CONFIG_EMAC_DESC_SECTION
+
 # base address for Rx Descriptors/Statuses
 emac_config_DEFINES += CONFIG_EMAC_RX_DESC_BASE
 # base address for Tx Descriptors
index d3745a602afa8e357bcd13f5f336cf4ee11de439..e9165652a86b2a48633832a866dd15c5a16fd03e 100644 (file)
@@ -51,6 +51,7 @@
   #define EMAC_NUM_TX_FRAG    2
 #endif
 
+#ifndef CONFIG_EMAC_DESC_SECTION
 /* placement of Rx descriptors. Required space = NUM_RX_FRAGS*(sizeof(emac_rx_descriptor_t)+sizeof(emac_rx_status_t)) */
 #ifdef CONFIG_EMAC_RX_DESC_BASE
   #define EMAC_RX_DESC_BASE   CONFIG_EMAC_RX_DESC_BASE
 #else
   #define EMAC_TX_DBUF_BASE   (EMAC_RX_DBUF_BASE + EMAC_NUM_RX_FRAG*EMAC_FRAG_SIZE)
 #endif
-
+#else /*CONFIG_EMAC_DESC_SECTION*/
+  /* Allocate memory from specified section */
+  #define EMAC_DESC_ATTR  \
+            __attribute__((section(CONFIG_EMAC_DESC_SECTION))) \
+            __attribute__((aligned(8)))
+
+  uint8_t lpc_emac_rx_desc[EMAC_NUM_RX_FRAG*(sizeof(emac_rx_descriptor_t)+sizeof(emac_rx_status_t))] EMAC_DESC_ATTR;
+  #define EMAC_RX_DESC_BASE   ((uintptr_t)lpc_emac_rx_desc)
+  uint8_t lpc_emac_tx_desc[EMAC_NUM_TX_FRAG*(sizeof(emac_tx_descriptor_t)+sizeof(emac_tx_status_t))] EMAC_DESC_ATTR;
+  #define EMAC_TX_DESC_BASE   ((uintptr_t)lpc_emac_tx_desc)
+  uint8_t lpc_emac_rx_dbuf[EMAC_NUM_RX_FRAG*EMAC_FRAG_SIZE] EMAC_DESC_ATTR;
+  #define EMAC_RX_DBUF_BASE   ((uintptr_t)lpc_emac_rx_dbuf)
+  uint8_t lpc_emac_tx_dbuf[EMAC_NUM_TX_FRAG*EMAC_FRAG_SIZE] EMAC_DESC_ATTR;
+  #define EMAC_TX_DBUF_BASE   ((uintptr_t)lpc_emac_tx_dbuf)
+#endif /*CONFIG_EMAC_DESC_SECTION*/
 
 /* Macros for obtaining addresses of buffers and descriptors. */
 #define EMAC_RX_DESCRIPTOR(i)   ((emac_rx_descriptor_t *)(EMAC_RX_DESC_BASE + i*sizeof(emac_rx_descriptor_t)))