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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [verif/] [sw/] [C/] [gmac_loopback.c] - Blame information for rev 71

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 53 dinesha
/*
2 71 dinesha
 * GMAC Software Loop Back.
3
 * Software continously check the Rx Q counter, If the RX Q counter is not zero,
4
 * Then it read the Rx descriptor and copy the information back to tx descriptor
5 53 dinesha
 */
6
 
7
/*---------------------------------------------------------------------------*/
8
 
9
#include <8051.h>
10
 
11
char cErrCnt;
12
/*---------------------------------------------------------------------------*/
13
 
14 54 dinesha
__xdata __at (0xA030) unsigned int read_data;
15 56 dinesha
__xdata unsigned long *rx_des_base;
16
__xdata unsigned long *tx_des_base;
17 53 dinesha
 
18
void main() {
19
 
20
    unsigned int cFrameCnt = 0;
21
    unsigned int desc_ptr   =0;
22
 
23
    while(1) {
24
       if((read_data & 0xF) != 0) { // Check the Rx Q Counter
25
          // Read the Receive Descriptor
26
          // tb_top.cpu_read('h4,{desc_rx_qbase,desc_ptr},read_data); 
27
          // Write the Tx Descriptor
28 56 dinesha
          rx_des_base = (__xdata unsigned long *) (0x7000 | desc_ptr);
29
          tx_des_base = (__xdata unsigned long *) (0x7040 | desc_ptr);
30 54 dinesha
          //rx_des_base = (__xdata unsigned int *) (0x7000+desc_ptr);
31
          //tx_des_base = (__xdata unsigned int *) (0x7040+desc_ptr);
32
          //__xdata (int *) (0x7040+desc_ptr) = __xdata (int *)(0x7000+desc_ptr);
33 53 dinesha
          // tb_top.cpu_write('h4,{desc_tx_qbase,desc_ptr},read_data); 
34 54 dinesha
          *tx_des_base = *rx_des_base;
35 56 dinesha
          desc_ptr = (desc_ptr+4) & 0x3F;
36 53 dinesha
          cFrameCnt  = cFrameCnt+1;
37
         }
38
    }
39
}

powered by: WebSVN 2.1.0

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