Ignore:
Timestamp:
Nov 3, 2014, 10:53:00 AM (10 years ago)
Author:
alain
Message:

Introducing dynamic allocation of peripheral channel(TTY, NIC, TIM, CMA)
Removint the ICU driver : ICU component not supported anymore.
Removing the FBF driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/nic_driver.h

    r295 r437  
    55// Copyright (c) UPMC-LIP6
    66///////////////////////////////////////////////////////////////////////////////////
     7// The nic_driver.c and nic_driver.h files are part ot the GIET-VM nano-kernel.
     8// This driver supports the vci_multi_nic component.
     9//
     10// It can exist only one network controller in the architecture, but this
     11// component supports several channels.
     12//
     13// It can be accessed directly by software with memcpy(),
     14// or it can be accessed through the vci_chbuf_dma component:
     15// 
     16// The '_nic_sync_write' and '_nic_sync_read' functions use a memcpy strategy to
     17// implement the transfer between a data buffer (user space) and the NIC
     18// buffer (kernel space). They are blocking until completion of the transfer.
     19//
     20// The _nic_cma_start() and _nic_cma_stop() functions use the VciChbufDma component
     21// to transfer a flow of packets from the NIC RX hard chbuf (two containers)
     22// to an user RX chbuf (two containers), and to transfer another flow of packets
     23// from an user TX chbuf (two containers) to the NIC TX chbuf (two containers).
     24// One NIC channel and two CMA channels must be allocated to the task
     25// in the mapping_info data structure.
     26//
     27// All these access functions return -1 in case of error.
     28//
     29// The SEG_NIC_BASE address must be defined in the hard_config.h file.
     30//////////////////////////////////////////////////////////////////////////////////
    731
    832#ifndef _GIET_NIC_DRIVERS_H_
    933#define _GIET_NIC_DRIVERS_H_
    1034
     35#include <giet_config.h>
     36
    1137///////////////////////////////////////////////////////////////////////////////////
    12 // NIC Registers  (vci_multi_nic)
     38//           Global Addressable Registers
    1339///////////////////////////////////////////////////////////////////////////////////
    1440
     
    5076};
    5177
    52 /////////////////////////////////////////////////////////////////////
     78/////////////////////////////////////////////////////////////////////////////////////
     79//            Channel Addressable Registers
    5380// A container descriptor has the following form:
    54 // LOW WORD : Container LSB base address     
    55 // HIGH WORD: Container status (leftmost bit), '1' means full
    56 //            Base address MSB extension, if needed (right aligned)
    57 //////////////////////////////////////////////////////////////////////
     81// LOW WORD  : 32 LSB bits of the container physical base address     
     82// HIGH WORD : 16 MSB bits of the container physical base address + status (bit 31) 
     83/////////////////////////////////////////////////////////////////////////////////////
    5884enum SoclibMultiNicChannelRegisters
    5985{
     
    7298};
    7399
     100
     101////////////////////////////////////////////////////////////////////////////////////
     102//              Chained Buffer Descriptor Structure
     103////////////////////////////////////////////////////////////////////////////////////
     104typedef struct nic_chbuf_s
     105{
     106    unsigned long long buf[GIET_CHBUF_NBUFS]; // array of buffer descriptors
     107    unsigned int       buf_length;            // buffer length (bytes)
     108    unsigned int       nb_buffers;            // actual number of buffers
     109} nic_chbuf_t;
     110
    74111///////////////////////////////////////////////////////////////////////////////////
    75 // NIC device access functions  (vci_multi_nic)
     112//              Initialization functions
    76113///////////////////////////////////////////////////////////////////////////////////
    77114
    78 extern unsigned int _nic_sync_write( const void*  buffer,
    79                                      unsigned int length );
     115extern int _nic_global_init( unsigned int channels,
     116                             unsigned int vis,
     117                             unsigned int bc_enable,
     118                             unsigned int bypass_enable );
    80119
    81 extern unsigned int _nic_sync_read(  const void*  buffer,
    82                                      unsigned int length );
     120extern int _nic_channel_init( unsigned int index,
     121                              unsigned int mac4,
     122                              unsigned int mac2 );
    83123
    84 extern unsigned int _nic_cma_start();
     124///////////////////////////////////////////////////////////////////////////////////
     125//              Blocking functions using a physical_memcpy()
     126///////////////////////////////////////////////////////////////////////////////////
    85127
    86 extern unsigned int _nic_cma_stop();
     128extern int _nic_sync_receive( unsigned int       channel,
     129                              unsigned long long user_paddr );
     130
     131extern int _nic_sync_send( unsigned int       channel,
     132                           unsigned long long user_paddr );
     133
     134///////////////////////////////////////////////////////////////////////////////////
     135//              Non blocking functions using the chained buffer DMA
     136///////////////////////////////////////////////////////////////////////////////////
     137
     138extern int _nic_cma_receive( unsigned int  nic_channel,
     139                             unsigned int  cma_channel,
     140                             nic_chbuf_t*  kernel_chbuf );
     141
     142extern int _nic_cma_send( unsigned int  nic_channel,
     143                          unsigned int  cma_channel,
     144                          nic_chbuf_t*  kernel_chbuf );
     145
     146///////////////////////////////////////////////////////////////////////////////////
     147//              Interrupt Service Routines
     148///////////////////////////////////////////////////////////////////////////////////
    87149
    88150extern void _nic_rx_isr( unsigned int irq_type,
     
    94156                         unsigned int channel );
    95157
    96 ///////////////////////////////////////////////////////////////////////////////////
    97158
    98159
Note: See TracChangeset for help on using the changeset viewer.