Stefan Schuermans
handle eth TX packets of odd size in HW
Stefan Schuermans commited 6d98945 at 2012-03-24 17:30:33
#include "config.h"
#include "eth.h"
static volatile unsigned int *const eth_ptr =
(volatile unsigned int *)0x80000400;
static unsigned int eth_idx_hw;
static unsigned int eth_rx_buf[2][381]; /* max frame: 1522 byte = 380.5 int */
static unsigned int *eth_rx_pos;
static unsigned int eth_rx_cnt;
static unsigned int eth_tx_cnt;
/**
* @brief set MAC address
* @param[in] mac MAC address
*/
static void eth_mac_set(const unsigned char mac[6])
{
unsigned int i;
for (i = 0; i < 6; ++i)
((volatile unsigned char *)(eth_ptr + 12))[i] = mac[i];
}
/**
* @brief provide new receive buffer
* @param[in] ptr pointer to new receive buffer
* @param[in] sz size of new receive buffer
*/
static void eth_rx_new_buf(void *ptr, unsigned int sz)
{
eth_ptr[4] = (unsigned int)ptr; /* new start */
eth_ptr[5] = (unsigned int)ptr + sz; /* new end */
eth_ptr[6] = 1; /* set flag */
while (eth_ptr[6] == 1); /* wait until processed */
}
/**
* @brief get buffer position of ethernet receiver
* @return current buffer position of ethernet receiver
*
* eveything before this position can be read
*/
static void * eth_rx_get_pos(void)
{
return (void *)eth_ptr[0];
}
/** initialize MAC address */
void eth_mac_init(void)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX