GT-64260A Design Guide
Doc. No. MV-S300165-00, Rev. A
CONFIDENTIAL
Copyright © 2002 Marvell
Page 158
Document Classification: Proprietary Information
May 21, 2002, Preliminary
Appendix E. Communication Example Code
E.1 Ethernet Initialization
/* Initialize the Communication Unit memory pool */
usrMemInit();
/* connect the MPSC and Ethernet as RMII ports */
GT_REG_WRITE(SERIAL_PORT_MULTIPLEX, 0x1102);
/* initialize the address table to filter other MAC addresses */
initAddressTable(ETHERNET_DOWNLOADING_PORT,0,1,0);
macH = (ifWanMacAddress[0] << 8) | (ifWanMacAddress[1]);
macL = (ifWanMacAddress[5] << 0) | (ifWanMacAddress[4] << 8) |
(ifWanMacAddress[3] << 16) | (ifWanMacAddress[2] << 24);
addAddressTableEntry(ETHERNET_DOWNLOADING_PORT,macH,macL,1,0);
/* rx prio0 */
allocStruct.bufferSize = BUFFER_SIZE_FOR_ETHERNET;
allocStruct.numberOfDescriptors = MIN_NUMBER_OF_ETHERNET_RX_DESC_ALLOC_PRIO0;
allocStruct.portNumber = ETHERNET_DOWNLOADING_PORT;
allocStruct.priority = PRIO0;
allocStruct.rxOrTx = RX_DESCRIPTOR;
allocStruct.protocolType = ETHERNET_PROTOCOL;
sdmaAllocateDescriptorsForOnePort(&allocStruct);
sdmaInitRxDescriptors(ETHERNET_DOWNLOADING_PORT,ETHERNET_PROTOCOL,PRIO0);
/* tx prio0 */
allocStruct.bufferSize = 0;
allocStruct.numberOfDescriptors = MIN_NUMBER_OF_ETHERNET_TX_DESC_ALLOC_PRIO0;
allocStruct.portNumber = ETHERNET_DOWNLOADING_PORT;
allocStruct.priority = PRIO0;
allocStruct.protocolType = ETHERNET_PROTOCOL;
allocStruct.rxOrTx = TX_DESCRIPTOR;
sdmaAllocateDescriptorsForOnePort(&allocStruct);
sdmaInitTxDescriptors(ETHERNET_DOWNLOADING_PORT,ETHERNET_PROTOCOL,PRIO0);
/* Set the buffers as Big Endian (rx and tx) */
GT_REG_WRITE(ETHERNET0_SDMA_CONFIGURATION_RE
ETHERNET_PORTS_DIFFERENCE_OFFSETS*ETHERNET_DOWNLOADING_PORT,