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
Line 
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>
10#include <hard_config.h>
11#include <rdk_driver.h>
12#include <utils.h>
13
14#if !defined(SEG_RDK_BASE)
15# error: You must define SEG_RDK_BASE in the hard_config.h file
16#endif
17
18//////////////////////////////////////////////
19unsigned int _rdk_init( unsigned int channel )
20{
21    return 0;
22}
23
24//////////////////////////////////////////
25unsigned int _rdk_read( unsigned int lba, 
26                        unsigned int buffer, 
27                        unsigned int count) 
28{
29#if USE_IOC_RDK
30
31#if GIET_DEBUG_IOC_DRIVER
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");
41#endif
42
43    char* src = (char*)SEG_RDK_BASE + (512*lba);
44    char* dst = (char*)buffer;
45    memcpy( dst, src, count*512 );
46    return 0;
47
48#else
49
50    _puts("[GIET ERROR] _rdk_read() should not be used if USE_IOC_RDK not set\n");
51    return 1;
52
53#endif
54}
55
56//////////////////////////////////////////
57unsigned int _rdk_write( unsigned int lba, 
58                         unsigned int buffer, 
59                         unsigned int count ) 
60{
61#if USE_IOC_RDK
62
63#if GIET_DEBUG_IOC_DRIVER
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");
73#endif
74
75    char* dst = (char*)SEG_RDK_BASE + (512*lba);
76    char* src = (char*)buffer;
77    memcpy( dst, src, count*512 );
78    return 0;
79
80#else
81
82    _puts("[GIET ERROR] _rdk_write() should not be used if USE_IOC_RDK not set\n");
83    return 1;
84
85#endif
86}
87
88//////////////////////////////////
89unsigned int _rdk_get_block_size() 
90{
91    return 512;
92}
93
94//////////////////////////////
95unsigned int _rdk_get_status() 
96{
97    return 0;
98}
99
100
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.