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/cma_driver.c

    r320 r437  
    44// Author    : alain greiner
    55// Copyright (c) UPMC-LIP6
    6 ///////////////////////////////////////////////////////////////////////////////////
    7 // The cma_driver.c and cma_driver.h files are part ot the GIET-VM kernel.
    8 // This driver supports the SocLib vci_chbuf_dma component, that is
    9 // a multi channels, chained buffer DMA controller.
    10 //
    11 // This component can be used in conjonction with the SocLib vci_frame_buffer
    12 // to display images, or with the SocLib vci_multi_nic controller to tranfer
    13 // both RX and TX packets between NIC and memory buffers.
    14 //
    15 // The SEG_DMA_BASE address must be defined in the hard_config.h file
    16 ////////////////////////////////////////////////////////////////////////////////////
    17 // Implementation notes:
    18 // 1. The higher level access functions can be found in the fbf_driver and
    19 //    nic_driver files.
    20 // 2. All accesses to CMA registers are done by the two
    21 //    _cma_set_register() and _cma_get_register() low-level functions,
    22 //    that are handling virtual / physical extended addressing.
    236///////////////////////////////////////////////////////////////////////////////////
    247
     
    3114#endif
    3215
    33 ///////////////////////////////////////////////////////////////////////////////
    34 // This low_level function returns the value contained in register (index).
    35 ///////////////////////////////////////////////////////////////////////////////
     16/////////////////////////////////////////////////////
    3617unsigned int _cma_get_register( unsigned int channel,
    3718                                unsigned int index )
     
    4223}
    4324
    44 ///////////////////////////////////////////////////////////////////////////////
    45 // This low-level function set a new value in register (index).
    46 ///////////////////////////////////////////////////////////////////////////////
     25/////////////////////////////////////////////
    4726void _cma_set_register( unsigned int channel,
    4827                        unsigned int index,
     
    5433}
    5534
    56 ///////////////////////////////////////////////////////////////////////////////
    57 // This ISR handles the IRQ generated by a CMA channel.
    58 ///////////////////////////////////////////////////////////////////////////////
     35////////////////////////////////////////////////////
     36void _cma_start_channel( unsigned int       channel,
     37                         unsigned long long src_paddr,
     38                         unsigned int       src_nbufs,
     39                         unsigned long long dst_paddr,
     40                         unsigned int       dst_nbufs,
     41                         unsigned int       buf_length )
     42{
     43    _cma_set_register( channel, CHBUF_SRC_DESC , (unsigned int)(src_paddr & 0xFFFFFFFF) );
     44    _cma_set_register( channel, CHBUF_SRC_EXT  , (unsigned int)(src_paddr >> 32) );
     45    _cma_set_register( channel, CHBUF_SRC_NBUFS, src_nbufs );
     46    _cma_set_register( channel, CHBUF_DST_DESC , (unsigned int)(dst_paddr & 0xFFFFFFFF) );
     47    _cma_set_register( channel, CHBUF_DST_EXT  , (unsigned int)(dst_paddr >> 32) );
     48    _cma_set_register( channel, CHBUF_DST_NBUFS, dst_nbufs );
     49    _cma_set_register( channel, CHBUF_BUF_SIZE , buf_length );
     50    _cma_set_register( channel, CHBUF_PERIOD   , 300 );
     51    _cma_set_register( channel, CHBUF_RUN      , 1 );
     52}
     53
     54//////////////////////////////////////////////
     55void _cma_stop_channel( unsigned int channel )
     56{
     57    _cma_set_register( channel, CHBUF_RUN      , 0 );
     58}
     59
     60//////////////////////////////////////
    5961void _cma_isr( unsigned int irq_type,
    6062               unsigned int irq_id,
    6163               unsigned int channel )
    6264{
    63     _printf("\n[GIET ERROR] _cma_isr() not implemented\n");
     65    _puts("\n[GIET ERROR] _cma_isr() not implemented\n");
    6466    _exit();
    6567}
Note: See TracChangeset for help on using the changeset viewer.