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

Last change on this file since 496 was 456, checked in by alain, 10 years ago

Defining the NIC and CMA drivers (validated by the classif application).
Updating other drivers to comply with the new tty0 common file.

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