| [283] | 1 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 2 | // File      : bdv_driver.h | 
|---|
 | 3 | // Date      : 01/11/2013 | 
|---|
 | 4 | // Author    : alain greiner | 
|---|
 | 5 | // Maintainer: cesar fuguet | 
|---|
 | 6 | // Copyright (c) UPMC-LIP6 | 
|---|
 | 7 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 8 |  | 
|---|
| [295] | 9 | #ifndef _GIET_BDV_DRIVER_H_ | 
|---|
 | 10 | #define _GIET_BDV_DRIVER_H_ | 
|---|
| [283] | 11 |  | 
|---|
| [350] | 12 | #include "utils.h" | 
|---|
 | 13 |  | 
|---|
| [295] | 14 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 15 | // BDV global variables | 
|---|
 | 16 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [283] | 17 |  | 
|---|
| [350] | 18 | extern giet_lock_t           _bdv_lock;    // BDV is a shared ressource | 
|---|
| [295] | 19 | extern volatile unsigned int _bdv_status;  // required for IRQ signaling | 
|---|
 | 20 | extern volatile unsigned int _bdv_gtid;    // descheduled task id = gpid<<16 + ltid | 
|---|
 | 21 |  | 
|---|
| [283] | 22 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [295] | 23 | // BDV registers, operations and status values | 
|---|
| [283] | 24 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 25 |  | 
|---|
| [295] | 26 | enum BDV_registers  | 
|---|
 | 27 | { | 
|---|
 | 28 |     BLOCK_DEVICE_BUFFER, | 
|---|
 | 29 |     BLOCK_DEVICE_LBA, | 
|---|
 | 30 |     BLOCK_DEVICE_COUNT, | 
|---|
 | 31 |     BLOCK_DEVICE_OP, | 
|---|
 | 32 |     BLOCK_DEVICE_STATUS, | 
|---|
 | 33 |     BLOCK_DEVICE_IRQ_ENABLE, | 
|---|
 | 34 |     BLOCK_DEVICE_SIZE, | 
|---|
 | 35 |     BLOCK_DEVICE_BLOCK_SIZE, | 
|---|
 | 36 |     BLOCK_DEVICE_BUFFER_EXT, | 
|---|
 | 37 | }; | 
|---|
| [283] | 38 |  | 
|---|
| [295] | 39 | enum BDV_operations  | 
|---|
 | 40 | { | 
|---|
 | 41 |     BLOCK_DEVICE_NOOP, | 
|---|
 | 42 |     BLOCK_DEVICE_READ, | 
|---|
 | 43 |     BLOCK_DEVICE_WRITE, | 
|---|
 | 44 | }; | 
|---|
| [283] | 45 |  | 
|---|
| [295] | 46 | enum BDV_status | 
|---|
 | 47 | { | 
|---|
 | 48 |     BLOCK_DEVICE_IDLE, | 
|---|
 | 49 |     BLOCK_DEVICE_BUSY, | 
|---|
 | 50 |     BLOCK_DEVICE_READ_SUCCESS, | 
|---|
 | 51 |     BLOCK_DEVICE_WRITE_SUCCESS, | 
|---|
 | 52 |     BLOCK_DEVICE_READ_ERROR, | 
|---|
 | 53 |     BLOCK_DEVICE_WRITE_ERROR, | 
|---|
 | 54 |     BLOCK_DEVICE_ERROR, | 
|---|
 | 55 | }; | 
|---|
| [283] | 56 |  | 
|---|
| [295] | 57 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 58 | // BDV access functions (vci_block_device) | 
|---|
 | 59 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [283] | 60 |  | 
|---|
| [295] | 61 | extern unsigned int _bdv_init(); | 
|---|
 | 62 |  | 
|---|
 | 63 | extern unsigned int _bdv_write( unsigned int       mode, | 
|---|
 | 64 |                                 unsigned int       lba,  | 
|---|
 | 65 |                                 unsigned long long buffer,  | 
|---|
 | 66 |                                 unsigned int       count ); | 
|---|
 | 67 |  | 
|---|
 | 68 | extern unsigned int _bdv_read(  unsigned int       mode, | 
|---|
 | 69 |                                 unsigned int       lba,  | 
|---|
 | 70 |                                 unsigned long long buffer, | 
|---|
 | 71 |                                 unsigned int       count ); | 
|---|
 | 72 |  | 
|---|
 | 73 | extern unsigned int _bdv_get_status(); | 
|---|
 | 74 |  | 
|---|
| [283] | 75 | extern unsigned int _bdv_get_block_size(); | 
|---|
 | 76 |  | 
|---|
| [295] | 77 | extern void _bdv_isr( unsigned irq_type, | 
|---|
 | 78 |                       unsigned irq_id, | 
|---|
 | 79 |                       unsigned channel ); | 
|---|
 | 80 |  | 
|---|
| [283] | 81 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 82 |  | 
|---|
 | 83 | #endif | 
|---|
 | 84 |  | 
|---|
 | 85 | // Local Variables: | 
|---|
 | 86 | // tab-width: 4 | 
|---|
 | 87 | // c-basic-offset: 4 | 
|---|
 | 88 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
 | 89 | // indent-tabs-mode: nil | 
|---|
 | 90 | // End: | 
|---|
 | 91 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
 | 92 |  | 
|---|