OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [drivers/] [eth.c] - Diff between revs 842 and 855

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 842 Rev 855
Line 1... Line 1...
#include "common.h"
#include "common.h"
#include "support.h"
#include "support.h"
#include "board.h"
#include "board.h"
#include "uart.h"
#include "uart.h"
#include "eth.h"
#include "eth.h"
 
#include "int.h"
#include "spr_defs.h"
#include "spr_defs.h"
 
 
extern int printf (const char *fmt, ...);
extern int printf (const char *fmt, ...);
extern void lolev_ie(void);
extern void lolev_ie(void);
extern void lolev_idis(void);
extern void lolev_idis(void);
Line 23... Line 24...
static void
static void
print_packet(unsigned long add, int len)
print_packet(unsigned long add, int len)
{
{
  int i;
  int i;
 
 
  printf("ipacket: add = %x len = %d\n", add, len);
  printf("ipacket: add = %lx len = %d\n", add, len);
  for(i = 0; i < len; i++) {
  for(i = 0; i < len; i++) {
      if(!(i % 16))
      if(!(i % 16))
          printf("\n");
          printf("\n");
      printf(" %.2x", *(((unsigned char *)add) + i));
      printf(" %.2x", *(((unsigned char *)add) + i));
  }
  }
Line 40... Line 41...
  int i;
  int i;
 
 
  bd = (eth_bd *)ETH_BD_BASE;
  bd = (eth_bd *)ETH_BD_BASE;
 
 
  for(i = 0; i < ETH_TXBD_NUM; i++){
  for(i = 0; i < ETH_TXBD_NUM; i++){
 
 
    /* Set Tx BD status */
    /* Set Tx BD status */
    bd[i].len_status = 0 << 16 | ETH_TX_BD_PAD | ETH_TX_BD_CRC | ETH_RX_BD_IRQ;
    bd[i].len_status = 0 << 16 | ETH_TX_BD_PAD | ETH_TX_BD_CRC | ETH_RX_BD_IRQ;
 
 
    /* Initialize Tx buffer pointer */
    /* Initialize Tx buffer pointer */
    bd[i].addr = ETH_DATA_BASE + (i * ETH_MAXBUF_LEN);
    bd[i].addr = ETH_DATA_BASE + (i * ETH_MAXBUF_LEN);
Line 70... Line 70...
  }
  }
 
 
  bd[i-1].len_status |= ETH_RX_BD_WRAP; // Last Rx BD - Wrap
  bd[i-1].len_status |= ETH_RX_BD_WRAP; // Last Rx BD - Wrap
}
}
 
 
void eth_init (void (*rec)(volatile unsigned char *, int))
/* Ethernet interrupt handler */
 
void eth_int (void)
{
{
 
}
 
 
 
void eth_init (void (*rec)(volatile unsigned char *, int))
 
{
  /* Reset ethernet core */
  /* Reset ethernet core */
  REG32(ETH_REG_BASE + ETH_MODER) = ETH_MODER_RST;    /* Reset ON */
  REG32(ETH_REG_BASE + ETH_MODER) = ETH_MODER_RST;    /* Reset ON */
  REG32(ETH_REG_BASE + ETH_MODER) &= ~ETH_MODER_RST;  /* Reset OFF */
  REG32(ETH_REG_BASE + ETH_MODER) &= ~ETH_MODER_RST;  /* Reset OFF */
 
 
  /* Setting TX BD number */
  /* Setting TX BD number */
Line 144... Line 148...
#endif
#endif
 
 
  /* Enable receiver and transmiter */
  /* Enable receiver and transmiter */
  REG32(ETH_REG_BASE + ETH_MODER) |= ETH_MODER_RXEN | ETH_MODER_TXEN;
  REG32(ETH_REG_BASE + ETH_MODER) |= ETH_MODER_RXEN | ETH_MODER_TXEN;
 
 
 
  /* Register interrupt handler */
 
  int_add (ETH_IRQ, eth_int);
}
}
 
 
/* Returns pointer to next free buffer; NULL if none available */
/* Returns pointer to next free buffer; NULL if none available */
void *eth_get_tx_buf ()
void *eth_get_tx_buf ()
{
{
Line 258... Line 264...
{
{
  /* Enable receiver and transmiter */
  /* Enable receiver and transmiter */
  REG32(ETH_REG_BASE + ETH_MODER) &= ~(ETH_MODER_RXEN | ETH_MODER_TXEN);
  REG32(ETH_REG_BASE + ETH_MODER) &= ~(ETH_MODER_RXEN | ETH_MODER_TXEN);
}
}
 
 
void eth_int(void)
 
{
 
}
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.