source: soft/giet_vm/giet_drivers/cma_driver.c @ 774

Last change on this file since 774 was 612, checked in by bellefin, 9 years ago

CMA driver: update the channel status values of the CMA component

File size: 2.5 KB
RevLine 
[298]1///////////////////////////////////////////////////////////////////////////////////
2// File      : cma_driver.c
3// Date      : 01/03/2014
4// Author    : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#include <cma_driver.h>
[320]9#include <hard_config.h>        
10#include <utils.h>
[456]11#include <tty0.h>
[298]12
[320]13#if !defined(SEG_CMA_BASE)
14# error: You must define SEG_CMA_BASE in the hard_config.h file
15#endif
16
[437]17/////////////////////////////////////////////////////
[298]18unsigned int _cma_get_register( unsigned int channel,
19                                unsigned int index )
20{
[320]21    unsigned int* vaddr = (unsigned int*)SEG_CMA_BASE + 
[298]22                           CHBUF_CHANNEL_SPAN*channel + index;
23    return _io_extended_read( vaddr );
24}
25
[437]26/////////////////////////////////////////////
[298]27void _cma_set_register( unsigned int channel,
28                        unsigned int index,
29                        unsigned int value ) 
30{
[320]31    unsigned int* vaddr = (unsigned int*)SEG_CMA_BASE + 
[298]32                           CHBUF_CHANNEL_SPAN*channel + index;
33    _io_extended_write( vaddr, value );
34}
35
[437]36
37//////////////////////////////////////
[298]38void _cma_isr( unsigned int irq_type,
39               unsigned int irq_id,
40               unsigned int channel )
41{
[448]42    // get CMA channel status
43    unsigned int status = _cma_get_register( channel, CHBUF_STATUS );
44
[456]45    _puts("\n[CMA WARNING] IRQ received for CMA channel ");
46    _putd( channel );
47    _puts(" blocked at cycle ");
48    _putd( _get_proctime() );
49    _puts("\nreset the CMA channel : ");
50
[448]51    if (status == CHANNEL_SRC_DESC_ERROR )
[456]52        _puts("impossible access to source chbuf descriptor\n");
[448]53
[612]54    else if (status == CHANNEL_SRC_STATUS_ERROR )
55        _puts("impossible access to source buffer status\n");
[448]56
57    else if (status == CHANNEL_DST_DESC_ERROR )
[456]58        _puts("impossible access to destination chbuf descriptor\n");
[448]59
[612]60    else if (status == CHANNEL_DST_STATUS_ERROR )
61        _puts("impossible access to destination buffer status\n");
[448]62
[612]63    else if (status == CHANNEL_DATA_ERROR )
64        _puts("impossible access to source or destination data buffer\n");
65
[448]66    else
[456]67        _puts("strange, because channel is not blocked...");
[448]68   
[456]69    // acknowledge IRQ and desactivates channel
[448]70    _cma_set_register( channel, CHBUF_RUN, 0 );
[298]71}
72
73// Local Variables:
74// tab-width: 4
75// c-basic-offset: 4
76// c-file-offsets:((innamespace . 0)(inline-open . 0))
77// indent-tabs-mode: nil
78// End:
79// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
80
Note: See TracBrowser for help on using the repository browser.