source: soft/giet_vm/giet_drivers/rdk_driver.c @ 454

Last change on this file since 454 was 437, checked in by alain, 10 years ago

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

File size: 2.3 KB
RevLine 
[298]1///////////////////////////////////////////////////////////////////////////////////
2// File      : rdk_driver.c
3// Date      : 13/02/2014
4// Author    : alain greiner
5// Maintainer: cesar fuguet
6// Copyright (c) UPMC-LIP6
7///////////////////////////////////////////////////////////////////////////////////
8
9#include <giet_config.h>
[320]10#include <hard_config.h>
[298]11#include <rdk_driver.h>
12#include <utils.h>
13
[320]14#if !defined(SEG_RDK_BASE)
15# error: You must define SEG_RDK_BASE in the hard_config.h file
16#endif
17
[437]18//////////////////////////////////////////////
[298]19unsigned int _rdk_init( unsigned int channel )
20{
21    return 0;
22}
23
[437]24//////////////////////////////////////////
[298]25unsigned int _rdk_read( unsigned int lba, 
26                        unsigned int buffer, 
27                        unsigned int count) 
28{
[437]29#if USE_IOC_RDK
[298]30
31#if GIET_DEBUG_IOC_DRIVER
[437]32_puts("\n[IOC DEBUG] Enter _rdk_read() at cycle ");
33_putd( _get_proctime() );
34_puts("\n - vaddr   = "); 
35_putx( buffer );
36-puts("\n - sectors = "); 
37_putd( count );
38-puts("\n - lba     = "); 
39_putx( lba );
40_puts("\n");
[298]41#endif
42
[320]43    char* src = (char*)SEG_RDK_BASE + (512*lba);
[298]44    char* dst = (char*)buffer;
[405]45    memcpy( dst, src, count*512 );
[298]46    return 0;
[437]47
[320]48#else
[437]49
50    _puts("[GIET ERROR] _rdk_read() should not be used if USE_IOC_RDK not set\n");
[320]51    return 1;
[437]52
[320]53#endif
[298]54}
55
[437]56//////////////////////////////////////////
[298]57unsigned int _rdk_write( unsigned int lba, 
58                         unsigned int buffer, 
59                         unsigned int count ) 
60{
[437]61#if USE_IOC_RDK
[298]62
63#if GIET_DEBUG_IOC_DRIVER
[437]64_puts("\n[IOC DEBUG] Enter _rdk_write() at cycle ");
65_putd( _get_proctime() );
66_puts("\n - vaddr   = "); 
67_putx( buffer );
68-puts("\n - sectors = "); 
69_putd( count );
70-puts("\n - lba     = "); 
71_putx( lba );
72_puts("\n");
[298]73#endif
74
[320]75    char* dst = (char*)SEG_RDK_BASE + (512*lba);
[298]76    char* src = (char*)buffer;
[405]77    memcpy( dst, src, count*512 );
[298]78    return 0;
[437]79
[320]80#else
[437]81
82    _puts("[GIET ERROR] _rdk_write() should not be used if USE_IOC_RDK not set\n");
[320]83    return 1;
[437]84
[320]85#endif
[298]86}
87
[437]88//////////////////////////////////
[298]89unsigned int _rdk_get_block_size() 
90{
91    return 512;
92}
93
[437]94//////////////////////////////
95unsigned int _rdk_get_status() 
96{
97    return 0;
98}
[298]99
[437]100
[298]101// Local Variables:
102// tab-width: 4
103// c-basic-offset: 4
104// c-file-offsets:((innamespace . 0)(inline-open . 0))
105// indent-tabs-mode: nil
106// End:
107// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
108
Note: See TracBrowser for help on using the repository browser.