* Initialize the transmit and receive DMA descriptor lists. */
| 275 | * Initialize the transmit and receive DMA descriptor lists. |
| 276 | */ |
| 277 | void |
| 278 | InitDMADescriptors(void) |
| 279 | { |
| 280 | uint32_t ui32Loop; |
| 281 | |
| 282 | /* Transmit list - mark all descriptors as not owned by the hardware */ |
| 283 | for(ui32Loop = 0; ui32Loop < NUM_TX_DESCRIPTORS; ui32Loop++) |
| 284 | { |
| 285 | g_pTxDescriptors[ui32Loop].pBuf = (struct pbuf *)0; |
| 286 | g_pTxDescriptors[ui32Loop].Desc.ui32Count = 0; |
| 287 | g_pTxDescriptors[ui32Loop].Desc.pvBuffer1 = 0; |
| 288 | g_pTxDescriptors[ui32Loop].Desc.DES3.pLink = |
| 289 | ((ui32Loop == (NUM_TX_DESCRIPTORS - 1)) ? |
| 290 | &g_pTxDescriptors[0].Desc : &g_pTxDescriptors[ui32Loop + 1].Desc); |
| 291 | g_pTxDescriptors[ui32Loop].Desc.ui32CtrlStatus = DES0_TX_CTRL_INTERRUPT | |
| 292 | DES0_TX_CTRL_CHAINED | DES0_TX_CTRL_IP_ALL_CKHSUMS; |
| 293 | |
| 294 | } |
| 295 | |
| 296 | g_TxDescList.ui32Read = 0; |
| 297 | g_TxDescList.ui32Write = 0; |
| 298 | |
| 299 | |
| 300 | /* Receive list - tag each descriptor with a pbuf and set all fields to |
| 301 | * allow packets to be received. |
| 302 | */ |
| 303 | for(ui32Loop = 0; ui32Loop < NUM_RX_DESCRIPTORS; ui32Loop++) |
| 304 | { |
| 305 | g_pRxDescriptors[ui32Loop].pBuf = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, |
| 306 | PBUF_POOL); |
| 307 | g_pRxDescriptors[ui32Loop].Desc.ui32Count = DES1_RX_CTRL_CHAINED; |
| 308 | if(g_pRxDescriptors[ui32Loop].pBuf) |
| 309 | { |
| 310 | /* Set the DMA to write directly into the pbuf payload. */ |
| 311 | g_pRxDescriptors[ui32Loop].Desc.pvBuffer1 = |
| 312 | g_pRxDescriptors[ui32Loop].pBuf->payload; |
| 313 | g_pRxDescriptors[ui32Loop].Desc.ui32Count |= |
| 314 | (g_pRxDescriptors[ui32Loop].pBuf->len << DES1_RX_CTRL_BUFF1_SIZE_S); |
| 315 | g_pRxDescriptors[ui32Loop].Desc.ui32CtrlStatus = DES0_RX_CTRL_OWN; |
| 316 | } |
| 317 | else |
| 318 | { |
| 319 | LWIP_DEBUGF(NETIF_DEBUG, ("tivaif_init: pbuf_alloc error\n")); |
| 320 | |
| 321 | /* No pbuf available so leave the buffer pointer empty. */ |
| 322 | g_pRxDescriptors[ui32Loop].Desc.pvBuffer1 = 0; |
| 323 | g_pRxDescriptors[ui32Loop].Desc.ui32CtrlStatus = 0; |
| 324 | } |
| 325 | g_pRxDescriptors[ui32Loop].Desc.DES3.pLink = |
| 326 | ((ui32Loop == (NUM_RX_DESCRIPTORS - 1)) ? |
| 327 | &g_pRxDescriptors[0].Desc : &g_pRxDescriptors[ui32Loop + 1].Desc); |
| 328 | } |
| 329 | |
| 330 | g_TxDescList.ui32Read = 0; |
| 331 | g_TxDescList.ui32Write = 0; |
| 332 | |
| 333 | // |
| 334 | // Set the descriptor pointers in the hardware. |
no test coverage detected