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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [eth/] [mcf52xx/] [mcf5272/] [v2_0/] [src/] [nbuf.c] - Blame information for rev 487

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//####ECOSGPLCOPYRIGHTBEGIN####
3
// -------------------------------------------
4
// This file is part of eCos, the Embedded Configurable Operating System.
5
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
6
//
7
// eCos is free software; you can redistribute it and/or modify it under
8
// the terms of the GNU General Public License as published by the Free
9
// Software Foundation; either version 2 or (at your option) any later version.
10
//
11
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
12
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
// for more details.
15
//
16
// You should have received a copy of the GNU General Public License along
17
// with eCos; if not, write to the Free Software Foundation, Inc.,
18
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19
//
20
// As a special exception, if other files instantiate templates or use macros
21
// or inline functions from this file, or you compile this file and link it
22
// with other works to produce a work based on this file, this file does not
23
// by itself cause the resulting work to be covered by the GNU General Public
24
// License. However the source code for this file must still be made available
25
// in accordance with section (3) of the GNU General Public License.
26
//
27
// This exception does not invalidate any other reasons why a work based on
28
// this file might be covered by the GNU General Public License.
29
//
30
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
31
// at http://sources.redhat.com/ecos/ecos-license/
32
// -------------------------------------------
33
//####ECOSGPLCOPYRIGHTEND####
34
//==========================================================================
35
 
36
#include <cyg/devs/eth/nbuf.h>
37
/*
38
 * Functions to manipulate the network buffers.
39
 */
40
 
41
#include <cyg/hal/hal_intr.h>
42
#include <cyg/infra/cyg_type.h>
43
 
44
#include <cyg/devs/eth/if_mcf5272.h>
45
#include <cyg/devs/eth/nbuf.h>
46
#include <cyg/infra/cyg_ass.h>
47
 
48
/*******************************************************************************
49
nbuf_init() - Initalize the networ buffers.
50
 
51
INPUT: pBuf - Pointer to the network buffer data.
52
*/
53
void
54
nbuf_init (buf_info_t* pBuf)
55
{
56
        uint_t i = 0;
57
    uint8 *buf = (uint8*)&(pBuf->RxBuffer);
58
    buf = (uint8*)((((uint32)buf+15)/16)*16);
59
 
60
    /* Initialize RxNBUF and TxNBUF */
61
    pBuf->RxNBUF = (NBUF*)((((uint32)(&pBuf->nrxbuf[0])+3)/4)*4);
62
    pBuf->TxNBUF = (NBUF*)((((uint32)(&pBuf->ntxbuf[0])+3)/4)*4);
63
 
64
        /* Initialize receive descriptor ring */
65
        for (i = 0; i < NUM_RXBDS; i++)
66
        {
67
                pBuf->RxNBUF[i].status = RX_BD_E;
68
                pBuf->RxNBUF[i].length = 0;
69
                pBuf->RxNBUF[i].data = buf;
70
        buf += RX_BUFFER_SIZE;
71
        }
72
        /* Set the Wrap bit on the last one in the ring */
73
        pBuf->RxNBUF[NUM_RXBDS - 1].status |= RX_BD_W;
74
 
75
        /* Initialize transmit descriptor ring */
76
        for (i = 0; i < NUM_TXBDS; i++)
77
        {
78
                pBuf->TxNBUF[i].length = 0;
79
                pBuf->TxNBUF[i].data = 0L;
80
        pBuf->TxNBUF[i].status = 0;
81
        }
82
        /* Set the Wrap bit on the last one in the ring */
83
        pBuf->TxNBUF[NUM_TXBDS - 1].status |= TX_BD_W;
84
 
85
        /* Initialize the buffer descriptor indexes */
86
        pBuf->iTxbd = pBuf->iRxbd = 0;
87
 
88
    /* Intiaize the transmit key queue to zero. */
89
    pBuf->tq_front = pBuf->tq_rear = 0;
90
 
91
    // Initalize the nubmer of transmit buffer descriptors used to zero.
92
 
93
    pBuf->num_busy_bd = 0;
94
}
95
 
96
 
97
 
98
 

powered by: WebSVN 2.1.0

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