|
|
|
Bean
FreescaleEthernetAPI
|
NE64 ethernet API routines
Methods are user callable functions/subroutines that are means of controlling the bean functions.
|
Methods:
-
NE64InitializeTransmissionBuffer
- This function initializes the TX buffer pointer to point so that it points to the first byte location in the buffer. This function needs a global variable to point to the Tx buffer.
ANSIC prototype: void NE64InitializeTransmissionBuffer(tU08 page)
- page:tU08 - no hint
-
NE64WriteEthernetHeaderToTxBuffer
- This function Writes the MAC Ethernet Header into the TX buffer. The Ethernet Header includes the MAC destination address, MAC source address, and the length/type fields. This function also increments the pointer of to the next byte in the TX buffer after the MAC Ethernet Header.
ANSIC prototype: void NE64WriteEthernetHeaderToTxBuffer(ethernet_frame *frame)
- frame: Pointer to ethernet_frame - Pointer to ethernet frame.
-
NE64WriteWord
- Writes word into the TX buffer and increments internal pointer to the next word in TX buffer.
ANSIC prototype: void NE64WriteWord(tU16 worddata)
- worddata:tU16 - Word value.
-
NE64WriteByte
- Writes byte into the TX buffer and increments internal pointer to the next byte in TX buffer.
ANSIC prototype: void NE64WriteByte(tU08 txdata)
- txdata:tU08 - Value
-
NE64WriteBytes
- Writes block of memory into the TX buffer and increments the internal pointer.
ANSIC prototype: void NE64WriteBytes(tU08 *buf,tU16 len)
- buf: Pointer to tU08 - Pointer to the block of memory with data.
- len:tU16 - Length of the block
-
NE64StartFrameTransmission
- This function starts Transmission of data in TX buffer.
ANSIC prototype: void NE64StartFrameTransmission(tU16 len)
- len:tU16 - Length of the frame.
-
NE64ValidFrameReception
- This function checks for valid reception of data in the RX buffers. This function also records which buffer has the valid data in a global variable.
Moreover, this function stores the packet data including: the destination MAC HW address, the source MAC HW address, the packet length/type field, and the size in bytes of the Ethernet MAC header. This information is stored in a global variable/received_frame structure .
ANSIC prototype: UINT16 NE64ValidFrameReception(void)
- Return value:UINT16 - True if the valid frame has been read.
-
NE64InitializeOffsetToReadRxBuffer
- Initializes internal pointer to the active RX buffer with specified offset.
ANSIC prototype: void NE64InitializeOffsetToReadRxBuffer(tU16 pos)
- pos:tU16 - Offset in active buffer.
-
NE64ReadByte
- This function reads a word from the RX buffer and increments the RX buffer pointer. The buffer read is buffer that triggered reception of valid data.
ANSIC prototype: UINT8 NE64ReadByte(void)
- Return value:UINT8 - Value read from RX buffer.
-
NE64ReadWord
- This function reads a word from the RX buffer and increments the RX buffer pointer. The buffer read is buffer that triggered reception of valid data.
ANSIC prototype: UINT16 NE64ReadWord(void)
- Return value:UINT16 - Value read from RX buffer.
-
NE64ReadBytes
- This function reads a specified number of bytes, length, from the RX buffer and increments the RX buffer pointer. The buffer read is buffer that triggered reception of valid data.
ANSIC prototype: void NE64ReadBytes(tU08 *buf,tU16 len)
- buf: Pointer to tU08 - Pointer to the block of received data.
- len:tU16 - Size of the block
-
NE64FreeReceiveBuffer
- This function clears the RX receive flag and makes the buffer available for the next packet to be received. This function also initializes the RX buffer pointers.
ANSIC prototype: void NE64FreeReceiveBuffer(void)
-
NE64GetCurrentReceivedFrame
- This function returns pointer to current received buffer.
ANSIC prototype: void NE64GetCurrentReceivedFrame(void)
-
MIIwrite
- Writes internal EPHY registers through EMAC MII serial management interface.
ANSIC prototype: tU08 MIIwrite(tU08 _mpadr,tU08 _mradr,tU16 _mwdata)
- _mpadr:tU08 - address of the device
- _mradr:tU08 - address of the register within the device
- _mwdata:tU16 - data to write to the PHY register
- Return value:tU08 - 0xff = operation completed OK
0x00 = MII busy
-
MIIread
- Reads internal EPHY registers through EMAC MII serial management interface.
ANSIC prototype: tU08 MIIread(tU08 _mpadr,tU08 _mradr,tU16 *_mrdata)
- _mpadr:tU08 - address of the device
- _mradr:tU08 - address of the register within the device
- _mrdata: Pointer to tU16 - pointer to where to store the received contents of PHY register
- Return value:tU08 - 0xff = operation completed OK
0x00 = MII busy
-
EtherInit
- This function initializes the NE64 EMAC and EPHY and sets speed and duplex based on the users configuation.
ANSIC prototype: void EtherInit(void)
-
EtherType
- This function sets the Ethertype acceptance registers based on the users configuration.
ANSIC prototype: void EtherType(tU08 control,tU16 etype)
- control:tU08 - the acceptance mask
- etype:tU16 - programmable ethertype
-
EtherIoctl
- Sets the multicast hash table.
ANSIC prototype: void EtherIoctl(tU08 flag,void* optionPtr,tU08 optionLen)
- flag:tU08 - either MC_ALL or MC_LIST
- optionPtr:void* - pointer to address list (valid only if flag == MC_LIST)
- optionLen:tU08 - number of addresses in list (valid only if flag == MC_LIST)
-
EtherGetPhysAddr
- Returns EMAC current physical address.
ANSIC prototype: void EtherGetPhysAddr(void* ethaddr)
- ethaddr:void* - pointer to place (6 bytes) where the physical address will be stored to
-
EtherSend
- This function sends one frame.
ANSIC prototype: void EtherSend(void* databuf,tU16 datalen)
- databuf:void* - pointer to data which should be sent
- datalen:tU16 - length of the data to be sent
-
EtherReceive
- This function reads the received frame.
ANSIC prototype: tU16 EtherReceive(void* buffer)
- buffer:void* - pointer to place where the physical address will be stored
- Return value:tU16 - length of the received data (if 0 - then no data received)
-
EtherReceiveZeroCopy
- This function reads the received frame with zero copy.
ANSIC prototype: tU16 EtherReceiveZeroCopy(tU08 *whichbuffer)
- whichbuffer: Pointer to tU08 - Pointer to the buffer.
- Return value:tU16 - Number of received bytes.
-
EtherOpen
- This function initializes the NE64 EMAC.
ANSIC prototype: void EtherOpen(tU08 miisetup,tU08 bufmap,tU16 maxfl,void* pmacad,tU08 control,tU16 etype,tU08 rxmode,tU08 netctl)
- miisetup:tU08 - mii preamble & clock setup
- bufmap:tU08 - buffer configuration (see tables 3-5&3-6 in EMAC doc.)
- maxfl:tU16 - initial max.frame length for receive
- pmacad:void* - pointer to MAC address definition
- control:tU08 - the acceptance mask (same as in EtherType function)
- etype:tU16 - programmable ethertype (16bit value)
- rxmode:tU08 - reception mode settings (see RXCT_X possible values)
- netctl:tU08 - network control setup (see NETCT_X possible values)
-
EtherClose
- This function switches off the EMAC and clear interrupt flags.
ANSIC prototype: void EtherClose(void)
-
EmacDisable
- Switches off the EMAC.
ANSIC prototype: void EmacDisable(void)
-
EmacEnable
- Switches on the EMAC.
ANSIC prototype: void EmacEnable(void)
-
EmacControl
- Sets control bits in EMAC netctl register.
ANSIC prototype: void EmacControl(tU08 netctl)
- netctl:tU08 - Value of netctl register
-
EtherAbortTx
- Aborts TX in progress.
ANSIC prototype: void EtherAbortTx(void)
-
EtherPause
- This function sends PAUSE frame.
ANSIC prototype: tU16 EtherPause(tU08 ptrc,tU16 ptime)
- ptrc:tU08 - if 1 ptime used for PAUSE time setting, if 0 ptime not used
- ptime:tU16 - value of PAUSE timer
- Return value:tU16 - Current PAUSE counter value
-
EtherOtherTx
- This function sets up of other TX parameters.
ANSIC prototype: void EtherOtherTx(tU08 txpar)
- txpar:tU08 - acceptable values (see TXCT_X possible values)
-
ExternalBusCfg
- This function sets up external bus mode and forces the bus clock to 16 Mhz which is the external bus mode maximum. The function needs to be located in main().
ANSIC prototype: void ExternalBusCfg(void)
-
UseSWLedRun
- This function turns off EPHY indicator LED when driven by software. The function need to be located in main() and required a global counter called, LEDcounter. lternatively, this code can be can be placed in a timer function .
ANSIC prototype: void UseSWLedRun(void)
Note: Some methods can be implemented as macros.
|
|
|
©1997-2004, UNIS, Ltd.
|
|
|