Nut/OS  4.10.3
API Reference
Crystal CS8900A

10 MBit Ethernet controller. More...

Collaboration diagram for Crystal CS8900A:

Data Structures

struct  _NICINFO
 Network interface controller information structure. More...

Typedefs

typedef struct _NICINFO NICINFO
 Network interface controller information type.

Functions

void CSWrite16 (uint32_t addr, uint16_t data)
void CSWritePP16 (uint16_t addr, uint16_t data)
uint16_t CSRead16 (uint32_t addr)
uint16_t CSReadPP16 (uint16_t addr)
void CSBeginFrame (void)
void CSEndFrame (void)
void CSWriteFrameByte (uint8_t data)
void CSSoftwareWakeup (void)
void CSSoftwareReset (void)
void CSNICrx (void *arg)
 NIC receiver thread.
int cs8900Output (NUTDEVICE *dev, NETBUF *nb)
 Send Ethernet packet.
int cs8900Init (NUTDEVICE *dev)
 Initialize Ethernet hardware.
void CSWrite16 (uint16_t addr, uint16_t data)
uint16_t CSRead16 (uint16_t addr)
uint32_t CSReadPP32 (unsigned int addr)
int CSNicOutput (NUTDEVICE *dev, NETBUF *nb)
 Send Ethernet packet.
int CSNicInit (NUTDEVICE *dev)
 Initialize Ethernet Interface.

Variables

volatile uint32_t cs_base = 0x82000000UL
NUTDEVICE devCS8900A
 Device information structure.
uint8_t cs_flags
volatile uint16_t cs_base = 0x0000

Detailed Description

10 MBit Ethernet controller.

The device driver for the CS8900A is poorly supported. Be prepared that some debugging may be required when using it with the latest Nut/Net release.


Typedef Documentation

typedef struct _NICINFO NICINFO

Network interface controller information type.

Definition at line 213 of file cs8900a.c.


Function Documentation

void CSWrite16 ( uint32_t  addr,
uint16_t  data 
)

Definition at line 227 of file cs8900a.c.

References cli, and sei.

Referenced by CSWritePP16().

void CSWritePP16 ( uint16_t  addr,
uint16_t  data 
)

Definition at line 239 of file cs8900a.c.

References cli, CS_PP_DATA0, CS_PP_PTR, and CSWrite16().

Referenced by cs8900Init(), and CSNicInit().

Here is the call graph for this function:

uint16_t CSRead16 ( uint32_t  addr)

Definition at line 254 of file cs8900a.c.

References cli, and sei.

Referenced by CSReadPP16().

uint16_t CSReadPP16 ( uint16_t  addr)

Definition at line 269 of file cs8900a.c.

References cli, CS_PP_DATA0, CS_PP_PTR, and CSRead16().

Referenced by cs8900Init(), CSNicInit(), and CSNICrx().

Here is the call graph for this function:

void CSBeginFrame ( void  )

Definition at line 282 of file cs8900a.c.

References cs_flags.

void CSEndFrame ( void  )

Definition at line 287 of file cs8900a.c.

References cli, CS_DATA_P0, cs_flags, and sei.

void CSWriteFrameByte ( uint8_t  data)

Definition at line 300 of file cs8900a.c.

References CS_DATA_P0, and cs_flags.

void CSSoftwareWakeup ( void  )

Definition at line 388 of file cs8900a.c.

References CS_PP_PTR, CS_SELF_CTRL, and NutDelay().

Referenced by cs8900Init(), and CSNicInit().

Here is the call graph for this function:

void CSSoftwareReset ( void  )

Definition at line 402 of file cs8900a.c.

References CS_DATA_P0, CS_PP_PTR, and CS_SELF_CTRL.

Referenced by cs8900Init(), and CSNicInit().

void CSNICrx ( void *  arg)

NIC receiver thread.

It runs with high priority.

Definition at line 421 of file cs8900a.c.

References CS_DATA_P0, CS_RX_EVENT, CSReadPP16(), _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, ifnet::if_recv, _NETBUF::nb_dl, NBAF_DATALINK, NICINFO::ni_rx_packets, NutNetBufAlloc(), NutSleep(), NutThreadSetPriority(), PSTR, and _NBDATA::vp.

Referenced by cs8900Init(), and CSNicInit().

Here is the call graph for this function:

int cs8900Output ( NUTDEVICE dev,
NETBUF nb 
)

Send Ethernet packet.

Parameters:
devIdentifies the device to use.
nbNetwork buffer structure containing the packet to be sent. The structure must have been allocated by a previous call NutNetBufAlloc().
Returns:
0 on success, -1 in case of any errors.

Definition at line 504 of file cs8900a.c.

References _NUTDEVICE::dev_dcb, NICINFO::ni_tx_packets, and PSTR.

int cs8900Init ( NUTDEVICE dev)

Initialize Ethernet hardware.

Resets the CS8900 Ethernet controller, initializes all required hardware registers and starts a background thread for incoming Ethernet traffic.

Applications should do not directly call this function. It is automatically executed during during device registration by NutRegisterDevice().

If the network configuration hasn't been set by the application before registering the specified device, this function will call NutNetLoadConfig() to get the MAC address.

Parameters:
devIdentifies the device to initialize.

Definition at line 541 of file cs8900a.c.

References _CONFNET::cd_size, _CONFNET::cdn_mac, confnet, cs_base, CS_IEEE_ADDR, CS_LINE_CTRL, CS_PROD_ID, CS_RX_CTL, CSNICrx(), CSReadPP16(), CSSoftwareReset(), CSSoftwareWakeup(), CSWritePP16(), _NUTDEVICE::dev_base, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _NUTDEVICE::dev_name, ifnet::if_mac, memcpy(), memset(), NutDelay(), NutNetLoadConfig(), NutThreadCreate(), and PSTR.

Here is the call graph for this function:

void CSWrite16 ( uint16_t  addr,
uint16_t  data 
)

Definition at line 236 of file cs8900.c.

References cli, and sei.

uint16_t CSRead16 ( uint16_t  addr)

Definition at line 259 of file cs8900.c.

References cli, and sei.

uint32_t CSReadPP32 ( unsigned int  addr)

Definition at line 283 of file cs8900.c.

References cli, CS_PP_DATA0, CS_PP_PTR, and sei.

int CSNicOutput ( NUTDEVICE dev,
NETBUF nb 
)

Send Ethernet packet.

Parameters:
devIdentifies the device to use.
nbNetwork buffer structure containing the packet to be sent. The structure must have been allocated by a previous call NutNetBufAlloc(). This buffer will be automatically released in case of an error.
Returns:
0 on success, -1 in case of any errors. Errors will automatically release the network buffer structure.

Definition at line 420 of file cs8900.c.

References _NUTDEVICE::dev_dcb, NICINFO::ni_tx_packets, and PSTR.

int CSNicInit ( NUTDEVICE dev)

Initialize Ethernet Interface.

Applications typically do not use this function, but call NutNetIfConfig().

Parameters:
devIdentifies the device to initialize. The structure must be properly set.

Definition at line 564 of file cs8900.c.

References _CONFNET::cd_size, _CONFNET::cdn_mac, confnet, cs_base, CS_IEEE_ADDR, CS_LINE_CTRL, CS_PROD_ID, CS_RX_CTL, CSNICrx(), CSReadPP16(), CSSoftwareReset(), CSSoftwareWakeup(), CSWritePP16(), _NUTDEVICE::dev_base, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _NUTDEVICE::dev_name, ifnet::if_mac, inb, memcpy(), memset(), NutDelay(), NutNetLoadConfig(), NutThreadCreate(), outb, PSTR, and RESETE.

Here is the call graph for this function:


Variable Documentation

volatile uint32_t cs_base = 0x82000000UL

Definition at line 221 of file cs8900a.c.

Referenced by cs8900Init(), and CSNicInit().

Initial value:
 {
    0,                          
    {'e', 't', 'h', '0', 0, 0, 0, 0, 0},        
    IFTYP_NET,                  
    0,                          
    0,                          
    &ifn_eth0,                  
    &dcb_eth0,                  
    cs8900Init,                 
    0,                          
    0,                          
    0,                          
    0,                          
    0,                          
    0                           
}

Device information structure.

A pointer to this structure must be passed to NutRegisterDevice() to bind this Ethernet device driver to the Nut/OS kernel. An application may then call NutNetIfConfig() with the name eth0 of this driver to initialize the network interface.

Definition at line 659 of file cs8900a.c.

Definition at line 232 of file cs8900.c.

Referenced by CSBeginFrame(), CSEndFrame(), and CSWriteFrameByte().

volatile uint16_t cs_base = 0x0000

Definition at line 233 of file cs8900.c.