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