@@ -89,15 +89,13 @@ typedef struct {
8989 uint8_t rhport ; // storage of \a rhport because some callbacks are done without it
9090
9191 // recv handling
92- CFG_TUSB_MEM_ALIGN recv_ntb_t recv_ntb [RECV_NTB_N ]; // actual recv NTBs
9392 recv_ntb_t * recv_free_ntb [RECV_NTB_N ]; // free list of recv NTBs
9493 recv_ntb_t * recv_ready_ntb [RECV_NTB_N ]; // NTBs waiting for transmission to glue logic
9594 recv_ntb_t * recv_tinyusb_ntb ; // buffer for the running transfer TinyUSB -> driver
9695 recv_ntb_t * recv_glue_ntb ; // buffer for the running transfer driver -> glue logic
9796 uint16_t recv_glue_ntb_datagram_ndx ; // index into \a recv_glue_ntb_datagram
9897
9998 // xmit handling
100- CFG_TUSB_MEM_ALIGN xmit_ntb_t xmit_ntb [XMIT_NTB_N ]; // actual xmit NTBs
10199 xmit_ntb_t * xmit_free_ntb [XMIT_NTB_N ]; // free list of xmit NTBs
102100 xmit_ntb_t * xmit_ready_ntb [XMIT_NTB_N ]; // NTBs waiting for transmission to TinyUSB
103101 xmit_ntb_t * xmit_tinyusb_ntb ; // buffer for the running transfer driver -> TinyUSB
@@ -118,15 +116,26 @@ typedef struct {
118116 bool tud_network_recv_renew_process_again ; // tud_network_recv_renew() should process again
119117} ncm_interface_t ;
120118
121- CFG_TUD_MEM_SECTION CFG_TUD_MEM_ALIGN tu_static ncm_interface_t ncm_interface ;
119+ typedef struct {
120+ struct {
121+ TUD_EPBUF_TYPE_DEF (ntb , recv_ntb_t );
122+ } recv [RECV_NTB_N ];
123+
124+ struct {
125+ TUD_EPBUF_TYPE_DEF (ntb , xmit_ntb_t );
126+ } xmit [XMIT_NTB_N ];
127+ } ncm_epbuf_t ;
128+
129+ static ncm_interface_t ncm_interface ;
130+ CFG_TUD_MEM_SECTION static ncm_epbuf_t ncm_epbuf ;
122131
123132/**
124133 * This is the NTB parameter structure
125134 *
126135 * \attention
127136 * We are lucky, that byte order is correct
128137 */
129- CFG_TUD_MEM_SECTION CFG_TUD_MEM_ALIGN tu_static const ntb_parameters_t ntb_parameters = {
138+ TU_ATTR_ALIGNED ( 4 ) static const ntb_parameters_t ntb_parameters = {
130139 .wLength = sizeof (ntb_parameters_t ),
131140 .bmNtbFormatsSupported = 0x01 ,// 16-bit NTB supported
132141 .dwNtbInMaxSize = CFG_TUD_NCM_IN_NTB_MAX_SIZE ,
@@ -743,10 +752,10 @@ void netd_init(void) {
743752 memset (& ncm_interface , 0 , sizeof (ncm_interface ));
744753
745754 for (int i = 0 ; i < XMIT_NTB_N ; ++ i ) {
746- ncm_interface .xmit_free_ntb [i ] = ncm_interface . xmit_ntb + i ;
755+ ncm_interface .xmit_free_ntb [i ] = & ncm_epbuf . xmit [ i ]. ntb ;
747756 }
748757 for (int i = 0 ; i < RECV_NTB_N ; ++ i ) {
749- ncm_interface .recv_free_ntb [i ] = ncm_interface . recv_ntb + i ;
758+ ncm_interface .recv_free_ntb [i ] = & ncm_epbuf . recv [ i ]. ntb ;
750759 }
751760} // netd_init
752761
0 commit comments