[298] | 1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : rdk_driver.h |
---|
| 3 | // Date : 13/02/2014 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[437] | 7 | // The rdk_driver.c and rdk_driver.h files are part ot the GIET-VM kernel. |
---|
| 8 | // |
---|
| 9 | // This driver supports a virtual disk implemented as a memory segment, |
---|
| 10 | // in the physical address space. |
---|
| 11 | // |
---|
| 12 | // The _rdk_read() and _rdk_write() blocking functions use a software memcpy, |
---|
| 13 | // whatever the selected mode. They return only when the transfer is completed. |
---|
| 14 | // As the number of concurrent accesses is not bounded, these functions |
---|
| 15 | // don't use the _ioc_lock variable. |
---|
| 16 | // |
---|
| 17 | // The SEG_RDK_BASE virtual address must be defined in the hard_config.h |
---|
| 18 | // file when the USE_RAMDISK flag is set. |
---|
| 19 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[298] | 20 | |
---|
| 21 | #ifndef _GIET_RDK_DRIVERS_H_ |
---|
| 22 | #define _GIET_RDK_DRIVERS_H_ |
---|
| 23 | |
---|
| 24 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 25 | // BDV access functions and variables (vci_block_device) |
---|
| 26 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 27 | |
---|
[437] | 28 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 29 | // This function does nothing, but is required by the IOC API. |
---|
| 30 | /////////////////////////////////////////////////////////////////////////////// |
---|
[298] | 31 | extern unsigned int _rdk_init(); |
---|
| 32 | |
---|
[437] | 33 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 34 | // Transfer data from a memory buffer to the RAMDISK. |
---|
| 35 | // - mode : BOOT / KERNEL / USER (unused) |
---|
| 36 | // - lba : first block index on the block device |
---|
| 37 | // - buffer : virtual base address of the memory buffer |
---|
| 38 | // - count : number of blocks to be transfered. |
---|
| 39 | // Returns 0 if success, > 0 if error. |
---|
| 40 | /////////////////////////////////////////////////////////////////////////////// |
---|
[298] | 41 | extern unsigned int _rdk_write( unsigned int lba, |
---|
| 42 | unsigned int buffer, |
---|
| 43 | unsigned int count ); |
---|
| 44 | |
---|
[437] | 45 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 46 | // Transfer data from the RAMDISK to a memory buffer. |
---|
| 47 | // - mode : BOOT / KERNEL / USER (unused) |
---|
| 48 | // - lba : first block index on the block device |
---|
| 49 | // - buffer : virtual base address of the memory buffer |
---|
| 50 | // - count : number of blocks to be transfered. |
---|
| 51 | // Returns 0 if success, > 0 if error. |
---|
| 52 | /////////////////////////////////////////////////////////////////////////////// |
---|
[298] | 53 | extern unsigned int _rdk_read( unsigned int lba, |
---|
| 54 | unsigned int buffer, |
---|
| 55 | unsigned int count ); |
---|
| 56 | |
---|
[437] | 57 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 58 | // This function returns the block size. |
---|
| 59 | /////////////////////////////////////////////////////////////////////////////// |
---|
[298] | 60 | extern unsigned int _rdk_get_block_size(); |
---|
| 61 | |
---|
| 62 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[437] | 63 | // This function returns always 0, but is required by the IOC API. |
---|
| 64 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 65 | extern unsigned int _rdk_get_status(); |
---|
[298] | 66 | |
---|
| 67 | #endif |
---|
| 68 | |
---|
| 69 | // Local Variables: |
---|
| 70 | // tab-width: 4 |
---|
| 71 | // c-basic-offset: 4 |
---|
| 72 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 73 | // indent-tabs-mode: nil |
---|
| 74 | // End: |
---|
| 75 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 76 | |
---|