Line 1... |
Line 1... |
/* Ethernet test */
|
/* Ethernet test */
|
|
|
#include "spr_defs.h"
|
#include "spr_defs.h"
|
#include "support.h"
|
#include "support.h"
|
|
#include "board.h"
|
|
|
typedef long off_t;
|
typedef long off_t;
|
|
|
#include "../peripheral/fields.h"
|
#include "../peripheral/fields.h"
|
#include "../peripheral/ethernet.h"
|
#include "../peripheral/ethernet.h"
|
|
|
#define ETH_BASE 0x88000000LU
|
|
#define ETH_INT_LINE 15
|
|
|
|
typedef volatile unsigned long *REGISTER;
|
typedef volatile unsigned long *REGISTER;
|
|
|
REGISTER
|
REGISTER
|
eth_moder = (unsigned long *)(ETH_BASE + ETH_MODER),
|
eth_moder = (unsigned long *)(ETH_BASE + ETH_MODER),
|
eth_int_source = (unsigned long *)(ETH_BASE + ETH_INT_SOURCE),
|
eth_int_source = (unsigned long *)(ETH_BASE + ETH_INT_SOURCE),
|
Line 32... |
Line 30... |
eth_miistatus = (unsigned long *)(ETH_BASE + ETH_MIISTATUS),
|
eth_miistatus = (unsigned long *)(ETH_BASE + ETH_MIISTATUS),
|
eth_mac_addr0 = (unsigned long *)(ETH_BASE + ETH_MAC_ADDR0),
|
eth_mac_addr0 = (unsigned long *)(ETH_BASE + ETH_MAC_ADDR0),
|
eth_mac_addr1 = (unsigned long *)(ETH_BASE + ETH_MAC_ADDR1),
|
eth_mac_addr1 = (unsigned long *)(ETH_BASE + ETH_MAC_ADDR1),
|
eth_bd_base = (unsigned long *)(ETH_BASE + ETH_BD_BASE);
|
eth_bd_base = (unsigned long *)(ETH_BASE + ETH_BD_BASE);
|
|
|
unsigned int_happend;
|
volatile unsigned int_happend;
|
unsigned char r_packet[2000];
|
unsigned char r_packet[2000];
|
unsigned char s_packet[1003];
|
unsigned char s_packet[1003];
|
unsigned tx_bindex;
|
unsigned tx_bindex;
|
unsigned rx_bindex;
|
unsigned rx_bindex;
|
|
|
Line 131... |
Line 129... |
SET_FIELD(eth_bd_base[tx_bindex], ETH_TX_BD, LENGTH, sizeof(s_packet));
|
SET_FIELD(eth_bd_base[tx_bindex], ETH_TX_BD, LENGTH, sizeof(s_packet));
|
eth_bd_base[tx_bindex + 1] = (unsigned long)s_packet;
|
eth_bd_base[tx_bindex + 1] = (unsigned long)s_packet;
|
|
|
/* Start Ethernet */
|
/* Start Ethernet */
|
printf("Set Flags\n");
|
printf("Set Flags\n");
|
|
SET_FLAG(eth_bd_base[tx_bindex], ETH_TX_BD, IRQ);
|
SET_FLAG(eth_bd_base[tx_bindex], ETH_TX_BD, READY);
|
SET_FLAG(eth_bd_base[tx_bindex], ETH_TX_BD, READY);
|
SET_FLAG(*eth_moder, ETH_MODER, TXEN);
|
SET_FLAG(*eth_moder, ETH_MODER, TXEN);
|
}
|
}
|
|
|
|
|
Line 166... |
Line 165... |
int_happend = 0;
|
int_happend = 0;
|
printf("Set BD\n");
|
printf("Set BD\n");
|
eth_bd_base[rx_bindex + 1] = (unsigned long)r_packet;
|
eth_bd_base[rx_bindex + 1] = (unsigned long)r_packet;
|
|
|
printf("SetFlags\n");
|
printf("SetFlags\n");
|
|
SET_FLAG(eth_bd_base[rx_bindex], ETH_RX_BD, IRQ);
|
SET_FLAG(eth_bd_base[rx_bindex], ETH_RX_BD, READY);
|
SET_FLAG(eth_bd_base[rx_bindex], ETH_RX_BD, READY);
|
SET_FLAG(*eth_moder, ETH_MODER, RXEN);
|
SET_FLAG(*eth_moder, ETH_MODER, RXEN);
|
}
|
}
|
|
|
int main()
|
int main()
|
Line 197... |
Line 197... |
/* interrupt test */
|
/* interrupt test */
|
excpt_int = (unsigned long)interrupt_handler;
|
excpt_int = (unsigned long)interrupt_handler;
|
/* Enable interrup ts */
|
/* Enable interrup ts */
|
printf("enable ints\n");
|
printf("enable ints\n");
|
mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
|
mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
|
mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << ETH_INT_LINE));
|
mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << ETH_IRQ));
|
|
|
printf("set mask flags TX\n");
|
printf("set mask flags TX\n");
|
SET_FLAG(*eth_int_mask, ETH_INT_MASK, TXB_M);
|
SET_FLAG(*eth_int_mask, ETH_INT_MASK, TXB_M);
|
transmit_one_packet_int();
|
transmit_one_packet_int();
|
tx_bindex += 2;
|
tx_bindex += 2;
|