12. lpc17xx_emac Module

Ethernet MAC client library functions. Find implementation details in LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library documentation.

class robovero.lpc17xx_emac.EMAC_CFG_Type(**kwargs)

Bases: robovero.internals.cstruct

EMAC configuration structure definition.

  • Mode: Supported EMAC PHY device speed, should be one of the following:

    • EMAC_MODE_AUTO
    • EMAC_MODE_10M_FULL
    • EMAC_MODE_10M_HALF
    • EMAC_MODE_100M_FULL
    • EMAC_MODE_100M_HALF
  • pbEMAC_Addr: Pointer to EMAC Station address that contains 6-bytes

    of MAC address, it must be sorted in order (bEMAC_Addr[0]..[5])

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).

robovero.lpc17xx_emac.EMAC_CLRT_COLL(n)

Programmable field representing the slot time or collision window during which collisions occur in properly configured networks.

robovero.lpc17xx_emac.EMAC_CLRT_MAX_RETX(n)

Programmable field specifying the number of retransmission attempts following a collision before aborting the packet due to excessive collisions.

robovero.lpc17xx_emac.EMAC_CheckPHYStatus(ulPHYState)

Check specified PHY status in EMAC peripheral.

Args:

  • ulPHYState: Specified PHY Status Type, should be:
    • EMAC_PHY_STAT_LINK: Link Status
    • EMAC_PHY_STAT_SPEED: Speed Status
    • EMAC_PHY_STAT_DUP: Duplex Status

Return:

  • Status of specified PHY status (0 or 1). -1 if error.
robovero.lpc17xx_emac.EMAC_CheckReceiveDataStatus(ulRxStatType)

Get current status value of receive data (due to RxConsumeIndex).

Args:

  • ulRxStatType: Received Status type, should be one of following:
    • EMAC_RINFO_CTRL_FRAME: Control Frame
    • EMAC_RINFO_VLAN: VLAN Frame
    • EMAC_RINFO_FAIL_FILT: RX Filter Failed
    • EMAC_RINFO_MCAST: Multicast Frame
    • EMAC_RINFO_BCAST: Broadcast Frame
    • EMAC_RINFO_CRC_ERR: CRC Error in Frame
    • EMAC_RINFO_SYM_ERR: Symbol Error from PHY
    • EMAC_RINFO_LEN_ERR: Length Error
    • EMAC_RINFO_RANGE_ERR: Range error(exceeded max size)
    • EMAC_RINFO_ALIGN_ERR: Alignment error
    • EMAC_RINFO_OVERRUN: Receive overrun
    • EMAC_RINFO_NO_DESCR: No new Descriptor available
    • EMAC_RINFO_LAST_FLAG: last Fragment in Frame
    • EMAC_RINFO_ERR: Error Occurred (OR of all error)

Return:

  • Current value of receive data (due to RxConsumeIndex)
robovero.lpc17xx_emac.EMAC_CheckReceiveIndex()

Check whether the current RxConsumeIndex is not equal to the current RxProduceIndex.

Return:

  • TRUE if they’re not equal, otherwise return FALSE
robovero.lpc17xx_emac.EMAC_CheckTransmitIndex()

Check whether if the current TxProduceIndex is not equal to the current RxProduceIndex - 1.

Return:

  • TRUE if they’re not equal, otherwise return FALSE
robovero.lpc17xx_emac.EMAC_DeInit()

De-initializes the EMAC peripheral registers to their default reset values.

robovero.lpc17xx_emac.EMAC_FCC_MIRR_CNT(n)

Mirror Counter.

robovero.lpc17xx_emac.EMAC_FCC_PAUSE_TIM(n)

Pause Timer.

robovero.lpc17xx_emac.EMAC_FCS_MIRR_CNT(n)

Mirror Counter Current.

robovero.lpc17xx_emac.EMAC_GetReceiveDataSize()

Get size of current Received data in received buffer (due to RxConsumeIndex).

Return:

  • Size of received data
robovero.lpc17xx_emac.EMAC_GetWoLStatus(ulWoLMode)

Get status of Wake On LAN Filter for each specified type in EMAC peripheral, clear this status if it is set.

Args:

  • ulWoLMode: WoL Filter mode, should be:

    • EMAC_WOL_UCAST: unicast frames caused WoL

    • EMAC_WOL_UCAST: broadcast frame caused WoL

    • EMAC_WOL_MCAST: multicast frame caused WoL

    • EMAC_WOL_UCAST_HASH: unicast frame that passes the imperfect hash

      filter caused WoL

    • EMAC_WOL_MCAST_HASH: multicast frame that passes the imperfect

      hash filter caused WoL

    • EMAC_WOL_PERFECT:perfect address matching filter caused WoL

    • EMAC_WOL_RX_FILTER: the receive filter caused WoL

    • EMAC_WOL_MAG_PACKET: the magic packet filter caused WoL

Return:

  • SET/RESET
robovero.lpc17xx_emac.EMAC_IPGR_NBBIPG_P1(n)

Programmable field representing the optional carrierSense window referenced in IEEE 802.3/4.2.3.2.1 ‘Carrier Deference’.

robovero.lpc17xx_emac.EMAC_IPGR_NBBIPG_P2(n)

Programmable field representing the Non-Back-to-Back Inter-Packet-Gap.

robovero.lpc17xx_emac.EMAC_IPGT_BBIPG(n)

Programmable field representing the nibble time offset of the minimum possible period between the end of any transmitted packet to the beginning of the next.

robovero.lpc17xx_emac.EMAC_Init(EMAC_ConfigStruct)

Initializes the EMAC peripheral according to the specified parameters in the EMAC_ConfigStruct.

Args:

  • EMAC_ConfigStruct: Pointer to a EMAC_CFG_Type structure that contains the

    configuration information for the specified EMAC peripheral.

robovero.lpc17xx_emac.EMAC_IntCmd(ulIntType, NewState)

Enable/Disable interrupt for each type in EMAC.

Args:

  • ulIntType: Interrupt Type, should be:
    • EMAC_INT_RX_OVERRUN: Receive Overrun
    • EMAC_INT_RX_ERR: Receive Error
    • EMAC_INT_RX_FIN: Receive Descriptor Finish
    • EMAC_INT_RX_DONE: Receive Done
    • EMAC_INT_TX_UNDERRUN: Transmit Under-run
    • EMAC_INT_TX_ERR: Transmit Error
    • EMAC_INT_TX_FIN: Transmit descriptor finish
    • EMAC_INT_TX_DONE: Transmit Done
    • EMAC_INT_SOFT_INT: Software interrupt
    • EMAC_INT_WAKEUP: Wakeup interrupt
  • NewState: New State of this function, should be: - ENABLE - DISABLE
robovero.lpc17xx_emac.EMAC_IntGetStatus(ulIntType)

Check whether if specified interrupt flag is set or not for each interrupt type in EMAC and clear interrupt pending if it is set.

Args:

  • ulIntType: Interrupt Type, should be:
    • EMAC_INT_RX_OVERRUN: Receive Overrun
    • EMAC_INT_RX_ERR: Receive Error
    • EMAC_INT_RX_FIN: Receive Descriptor Finish
    • EMAC_INT_RX_DONE: Receive Done
    • EMAC_INT_TX_UNDERRUN: Transmit Under-run
    • EMAC_INT_TX_ERR: Transmit Error
    • EMAC_INT_TX_FIN: Transmit descriptor finish
    • EMAC_INT_TX_DONE: Transmit Done
    • EMAC_INT_SOFT_INT: Software interrupt
    • EMAC_INT_WAKEUP: Wakeup interrupt

Return:

  • New state of specified interrupt (SET or RESET)
robovero.lpc17xx_emac.EMAC_MADR_PHY_ADR(n)

PHY Address Field.

robovero.lpc17xx_emac.EMAC_MADR_REG_ADR(n)

MII Register Address field.

robovero.lpc17xx_emac.EMAC_MAXF_MAXFRMLEN(n)

Represents a maximum receive frame of 1536 octets.

robovero.lpc17xx_emac.EMAC_MCFG_CLK_SEL(n)

Clock Select Field.

robovero.lpc17xx_emac.EMAC_MRDD_DATA(n)

Data field for MMI Management Read Data register.

robovero.lpc17xx_emac.EMAC_MWTD_DATA(n)

Data field for MMI Management Write Data register.

class robovero.lpc17xx_emac.EMAC_PACKETBUF_Type(**kwargs)

Bases: robovero.internals.cstruct

TX Data Buffer structure definition.

  • ulDataLen: Data length

  • pbDataBuf: A word-align data pointer to data buffer

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).

robovero.lpc17xx_emac.EMAC_RCTRL_SIZE(n)

Buffer size field.

robovero.lpc17xx_emac.EMAC_ReadPacketBuffer(pDataStruct)

Read data from Rx packet data buffer at current index due to RxConsumeIndex.

Args:

  • pDataStruct: Pointer to a EMAC_PACKETBUF_Type structure data that contain

    specified information about Packet data buffer.

robovero.lpc17xx_emac.EMAC_SetFilterMode(ulFilterMode, NewState)

Enable/Disable Filter mode for each specified type EMAC peripheral.

Args:

  • ulFilterMode: Filter mode, should be:
    • EMAC_RFC_UCAST_EN: all frames of unicast types will be accepted
    • EMAC_RFC_BCAST_EN: broadcast frame will be accepted
    • EMAC_RFC_MCAST_EN: all frames of multicast types will be accepted
    • EMAC_RFC_UCAST_HASH_EN: The imperfect hash filter will be applied to unicast addresses
    • EMAC_RFC_MCAST_HASH_EN: The imperfect hash filter will be applied to multicast addresses
    • EMAC_RFC_PERFECT_EN: the destination address will be compared with the 6 byte station address programmed in the station address by the filter
    • EMAC_RFC_MAGP_WOL_EN: the result of the magic packet filter will generate a WoL interrupt when there is a match
    • EMAC_RFC_PFILT_WOL_EN: the result of the perfect address matching filter and the imperfect hash filter will generate a WoL interrupt when there is a match
  • NewState: New State of this command, should be:
    • ENABLE
    • DISABLE
robovero.lpc17xx_emac.EMAC_SetHashFilter(dstMAC_addr, NewState)

Enable/Disable hash filter functionality for specified destination MAC address in EMAC module.

Args:

  • dstMAC_addr: Pointer to the first MAC destination address, should be 6-bytes

    length, in order LSB to the MSB

  • NewState: New State of this command, should be:

    • ENABLE
    • DISABLE
robovero.lpc17xx_emac.EMAC_SetPHYMode(ulPHYMode)

Set specified PHY mode in EMAC peripheral.

Args:

  • ulPHYMode: Specified PHY mode, should be:
    • EMAC_MODE_AUTO
    • EMAC_MODE_10M_FULL
    • EMAC_MODE_10M_HALF
    • EMAC_MODE_100M_FULL
    • EMAC_MODE_100M_HALF

Return:

  • 0 if no error, otherwise -1
robovero.lpc17xx_emac.EMAC_UpdatePHYStatus()

Auto-Configures value for the EMAC configuration register to match with current PHY mode.

Return:

  • 0 if no error, otherwise -1
robovero.lpc17xx_emac.EMAC_UpdateRxConsumeIndex()

Increase the RxConsumeIndex (after reading the Receive buffer to release the Receive buffer) and wrap-around the index if it reaches the maximum Receive Number.

robovero.lpc17xx_emac.EMAC_UpdateTxProduceIndex()

Increase the TxProduceIndex (after writting to the Transmit buffer to enable the Transmit buffer) and wrap-around the index if it reaches the maximum Transmit Number.

robovero.lpc17xx_emac.EMAC_WritePacketBuffer(pDataStruct)

Write data to Tx packet data buffer at current index due to TxProduceIndex.

Args:

  • pDataStruct: Pointer to a EMAC_PACKETBUF_Type structure data that contain

    specified information about Packet data buffer.

class robovero.lpc17xx_emac.RX_Desc(**kwargs)

Bases: robovero.internals.cstruct

RX Descriptor structure type definition.

  • Packet: Receive Packet Descriptor

  • Ctrl: Receive Control Descriptor

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).

class robovero.lpc17xx_emac.RX_Stat(**kwargs)

Bases: robovero.internals.cstruct

RX Status structure type definition.

  • Info: Receive Information Status

  • HashCRC: Receive Hash CRC Status

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).

class robovero.lpc17xx_emac.TX_Desc(**kwargs)

Bases: robovero.internals.cstruct

TX Descriptor structure type definition.

  • Packet: Transmit Packet Descriptor

  • Ctrl: Transmit Control Descriptor

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).

class robovero.lpc17xx_emac.TX_Stat(**kwargs)

Bases: robovero.internals.cstruct

TX Status structure type definition.

  • Info: Transmit Information Status

  • ptr: LPC1769 memory address where structure is stored. Use this in place of

    the C reference operator (&).