KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Typedefs | Functions
broadband_adapter.h File Reference

Broadband Adapter support. More...

#include <sys/cdefs.h>

Go to the source code of this file.

Macros

#define RT_IDR0   0x00
 MAC address. More...
 
#define RT_MAR0   0x08
 Multicast filter. More...
 
#define RT_TXSTATUS0   0x10
 Transmit status (4 32bit regs) More...
 
#define RT_TXADDR0   0x20
 Tx descriptors (also 4 32bit) More...
 
#define RT_RXBUF   0x30
 Receive buffer start address. More...
 
#define RT_RXEARLYCNT   0x34
 Early Rx byte count. More...
 
#define RT_RXEARLYSTATUS   0x36
 Early Rx status. More...
 
#define RT_CHIPCMD   0x37
 Command register. More...
 
#define RT_RXBUFTAIL   0x38
 Current address of packet read (queue tail) More...
 
#define RT_RXBUFHEAD   0x3A
 Current buffer address (queue head) More...
 
#define RT_INTRMASK   0x3C
 Interrupt mask. More...
 
#define RT_INTRSTATUS   0x3E
 Interrupt status. More...
 
#define RT_TXCONFIG   0x40
 Tx config. More...
 
#define RT_RXCONFIG   0x44
 Rx config. More...
 
#define RT_TIMER   0x48
 A general purpose counter. More...
 
#define RT_RXMISSED   0x4C
 24 bits valid, write clears More...
 
#define RT_CFG9346   0x50
 93C46 command register More...
 
#define RT_CONFIG0   0x51
 Configuration reg 0. More...
 
#define RT_CONFIG1   0x52
 Configuration reg 1. More...
 
#define RT_TIMERINT   0x54
 Timer interrupt register (32 bits) More...
 
#define RT_MEDIASTATUS   0x58
 Media status register. More...
 
#define RT_CONFIG3   0x59
 Config register 3. More...
 
#define RT_CONFIG4   0x5A
 Config register 4. More...
 
#define RT_MULTIINTR   0x5C
 Multiple interrupt select. More...
 
#define RT_MII_TSAD   0x60
 Transmit status of all descriptors (16 bits) More...
 
#define RT_MII_BMCR   0x62
 Basic Mode Control Register (16 bits) More...
 
#define RT_MII_BMSR   0x64
 Basic Mode Status Register (16 bits) More...
 
#define RT_AS_ADVERT   0x66
 Auto-negotiation advertisement reg (16 bits) More...
 
#define RT_AS_LPAR   0x68
 Auto-negotiation link partner reg (16 bits) More...
 
#define RT_AS_EXPANSION   0x6A
 Auto-negotiation expansion reg (16 bits) More...
 
#define RT_MII_AN_START   0x0200
 Start auto-negotiation. More...
 
#define RT_MII_AN_ENABLE   0x1000
 Enable auto-negotiation. More...
 
#define RT_MII_RESET   0x8000
 Reset the MII chip. More...
 
#define RT_MII_LINK   0x0004
 Link is present. More...
 
#define RT_MII_AN_CAPABLE   0x0008
 Can do auto negotiation. More...
 
#define RT_MII_AN_COMPLETE   0x0020
 Auto-negotiation complete. More...
 
#define RT_MII_10_HALF   0x0800
 Can do 10Mbit half duplex. More...
 
#define RT_MII_10_FULL   0x1000
 Can do 10Mbit full. More...
 
#define RT_MII_100_HALF   0x2000
 Can do 100Mbit half. More...
 
#define RT_MII_100_FULL   0x4000
 Can do 100Mbit full. More...
 
#define RT_CMD_RESET   0x10
 Reset the RTL8139C. More...
 
#define RT_CMD_RX_ENABLE   0x08
 Enable Rx. More...
 
#define RT_CMD_TX_ENABLE   0x04
 Enable Tx. More...
 
#define RT_CMD_RX_BUF_EMPTY   0x01
 Empty the Rx buffer. More...
 
#define RT_INT_PCIERR   0x8000
 PCI Bus error. More...
 
#define RT_INT_TIMEOUT   0x4000
 Set when TCTR reaches TimerInt value. More...
 
#define RT_INT_RXFIFO_OVERFLOW   0x0040
 Rx FIFO overflow. More...
 
#define RT_INT_RXFIFO_UNDERRUN   0x0020
 Packet underrun / link change. More...
 
#define RT_INT_LINK_CHANGE   0x0020
 Packet underrun / link change. More...
 
#define RT_INT_RXBUF_OVERFLOW   0x0010
 Rx BUFFER overflow. More...
 
#define RT_INT_TX_ERR   0x0008
 Tx error. More...
 
#define RT_INT_TX_OK   0x0004
 Tx OK. More...
 
#define RT_INT_RX_ERR   0x0002
 Rx error. More...
 
#define RT_INT_RX_OK   0x0001
 Rx OK. More...
 
#define RT_INT_RX_ACK   (RT_INT_RXFIFO_OVERFLOW | RT_INT_RXBUF_OVERFLOW | RT_INT_RX_OK)
 Composite RX bits we check for while doing an RX interrupt. More...
 
#define RT_TX_CARRIER_LOST   0x80000000
 Carrier sense lost. More...
 
#define RT_TX_ABORTED   0x40000000
 Transmission aborted. More...
 
#define RT_TX_OUT_OF_WINDOW   0x20000000
 Out of window collision. More...
 
#define RT_TX_STATUS_OK   0x00008000
 Status ok: a good packet was transmitted. More...
 
#define RT_TX_UNDERRUN   0x00004000
 Transmit FIFO underrun. More...
 
#define RT_TX_HOST_OWNS   0x00002000
 Set to 1 when DMA operation is completed. More...
 
#define RT_TX_SIZE_MASK   0x00001fff
 Descriptor size mask. More...
 
#define RT_RX_MULTICAST   0x00008000
 Multicast packet. More...
 
#define RT_RX_PAM   0x00004000
 Physical address matched. More...
 
#define RT_RX_BROADCAST   0x00002000
 Broadcast address matched. More...
 
#define RT_RX_BAD_SYMBOL   0x00000020
 Invalid symbol in 100TX packet. More...
 
#define RT_RX_RUNT   0x00000010
 Packet size is <64 bytes. More...
 
#define RT_RX_TOO_LONG   0x00000008
 Packet size is >4K bytes. More...
 
#define RT_RX_CRC_ERR   0x00000004
 CRC error. More...
 
#define RT_RX_FRAME_ALIGN   0x00000002
 Frame alignment error. More...
 
#define RT_RX_STATUS_OK   0x00000001
 Status ok: a good packet was received. More...
 
#define BBA_TX_OK   0
 Transmit success. More...
 
#define BBA_TX_ERROR   -1
 Transmit error. More...
 
#define BBA_TX_AGAIN   -2
 Retry transmit again. More...
 
#define BBA_TX_NOWAIT   0
 Don't block waiting for the transfer. More...
 
#define BBA_TX_WAIT   1
 Wait, if needed on transfer. More...
 

Typedefs

typedef void(* eth_rx_callback_t )(uint8 *pkt, int len)
 Receive packet callback function type. More...
 

Functions

void bba_get_mac (uint8 *arr)
 Retrieve the MAC Address of the attached BBA. More...
 
void bba_set_rx_callback (eth_rx_callback_t cb)
 Set the ethernet packet receive callback. More...
 
int bba_tx (const uint8 *pkt, int len, int wait)
 Transmit a single packet. More...
 

Detailed Description

Broadband Adapter support.

This file contains declarations related to support for the HIT-0400 "Broadband Adapter". There's not really anything that users will generally have to deal with in here.

Author
Dan Potter

Macro Definition Documentation

#define BBA_TX_NOWAIT   0

Don't block waiting for the transfer.

#define BBA_TX_WAIT   1

Wait, if needed on transfer.

Typedef Documentation

typedef void(* eth_rx_callback_t)(uint8 *pkt, int len)

Receive packet callback function type.

When a packet is received by the BBA, the callback function will be called to handle it.

Parameters
pktA pointer to the packet in question.
lenThe length, in bytes, of the packet.

Function Documentation

void bba_get_mac ( uint8 arr)

Retrieve the MAC Address of the attached BBA.

This function reads the MAC Address of the BBA and places it in the buffer passed in. The resulting data is undefined if no BBA is connected.

Parameters
arrThe array to read the MAC into.
void bba_set_rx_callback ( eth_rx_callback_t  cb)

Set the ethernet packet receive callback.

This function sets the function called when a packet is received by the BBA. Generally, this inputs into the network layer.

Parameters
cbA pointer to the new callback function.
int bba_tx ( const uint8 pkt,
int  len,
int  wait 
)

Transmit a single packet.

This function transmits a single packet on the bba, waiting for the link to become stable, if requested.

Parameters
pktThe packet to transmit.
lenThe length of the packet, in bytes.
waitBBA_TX_WAIT if you don't mind blocking for the all clear to transmit, BBA_TX_NOWAIT otherwise.
Return values
BBA_TX_OKOn success.
BBA_TX_ERRORIf there was an error transmitting the packet.
BBA_TX_AGAINIf BBA_TX_NOWAIT was specified and it is not ok to transmit right now.