/* In reality MAL can handle TX buffers up to 4095 bytes long, *butthisisn'tagoodroundnumber:)--ebs
*/ #define MAL_MAX_TX_SIZE 4080 #define MAL_MAX_RX_SIZE 4080
staticinlineint mal_rx_size(int len)
{
len = (len + 0xf) & ~0xf; return len > MAL_MAX_RX_SIZE ? MAL_MAX_RX_SIZE : len;
}
/* MAL Buffer Descriptor structure */ struct mal_descriptor {
u16 ctrl; /* MAL / Commac status control bits */
u16 data_len; /* Max length is 4K-1 (12 bits) */
u32 data_ptr; /* pointer to actual data buffer */
};
/* the following defines are for the MadMAL status and control registers. */ /* MADMAL transmit and receive status/control bits */ #define MAL_RX_CTRL_EMPTY 0x8000 #define MAL_RX_CTRL_WRAP 0x4000 #define MAL_RX_CTRL_CM 0x2000 #define MAL_RX_CTRL_LAST 0x1000 #define MAL_RX_CTRL_FIRST 0x0800 #define MAL_RX_CTRL_INTR 0x0400 #define MAL_RX_CTRL_SINGLE (MAL_RX_CTRL_LAST | MAL_RX_CTRL_FIRST) #define MAL_IS_SINGLE_RX(ctrl) (((ctrl) & MAL_RX_CTRL_SINGLE) == MAL_RX_CTRL_SINGLE)
struct mal_instance { int version;
dcr_host_t dcr_host;
int num_tx_chans; /* Number of TX channels */ int num_rx_chans; /* Number of RX channels */ int txeob_irq; /* TX End Of Buffer IRQ */ int rxeob_irq; /* RX End Of Buffer IRQ */ int txde_irq; /* TX Descriptor Error IRQ */ int rxde_irq; /* RX Descriptor Error IRQ */ int serr_irq; /* MAL System Error IRQ */
/* Set if you have interrupt coalescing and you have to clear the SDR *registerforTXEOBandRXEOBinterruptstowork
*/ #define MAL_FTR_CLEAR_ICINTSTAT 0x00000001
/* Set if your MAL has SERR, TXDE, and RXDE OR'd into a single UIC *interrupt
*/ #define MAL_FTR_COMMON_ERR_INT 0x00000002
/* Register MAL devices */ int mal_init(void); void mal_exit(void);
int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac); void mal_unregister_commac(struct mal_instance *mal, struct mal_commac *commac); int mal_set_rcbs(struct mal_instance *mal, int channel, unsignedlong size);
/* Returns BD ring offset for a particular channel (in'structmal_descriptor'elements)
*/ int mal_tx_bd_offset(struct mal_instance *mal, int channel); int mal_rx_bd_offset(struct mal_instance *mal, int channel);
void mal_enable_tx_channel(struct mal_instance *mal, int channel); void mal_disable_tx_channel(struct mal_instance *mal, int channel); void mal_enable_rx_channel(struct mal_instance *mal, int channel); void mal_disable_rx_channel(struct mal_instance *mal, int channel);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.