1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : ioc_driver.h |
---|
3 | // Date : 01/11/2013 |
---|
4 | // Author : alain greiner |
---|
5 | // Copyright (c) UPMC-LIP6 |
---|
6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
7 | |
---|
8 | #ifndef _GIET_IOC_DRIVERS_H_ |
---|
9 | #define _GIET_IOC_DRIVERS_H_ |
---|
10 | |
---|
11 | /////////////////////////////////////////////////////////////////////////////////// |
---|
12 | // IOC (vci_block device) registers offsets |
---|
13 | /////////////////////////////////////////////////////////////////////////////////// |
---|
14 | |
---|
15 | enum IOC_registers |
---|
16 | { |
---|
17 | BLOCK_DEVICE_BUFFER, |
---|
18 | BLOCK_DEVICE_LBA, |
---|
19 | BLOCK_DEVICE_COUNT, |
---|
20 | BLOCK_DEVICE_OP, |
---|
21 | BLOCK_DEVICE_STATUS, |
---|
22 | BLOCK_DEVICE_IRQ_ENABLE, |
---|
23 | BLOCK_DEVICE_SIZE, |
---|
24 | BLOCK_DEVICE_BLOCK_SIZE, |
---|
25 | BLOCK_DEVICE_BUFFER_EXT, |
---|
26 | }; |
---|
27 | enum IOC_operations |
---|
28 | { |
---|
29 | BLOCK_DEVICE_NOOP, |
---|
30 | BLOCK_DEVICE_READ, |
---|
31 | BLOCK_DEVICE_WRITE, |
---|
32 | }; |
---|
33 | enum IOC_status |
---|
34 | { |
---|
35 | BLOCK_DEVICE_IDLE, |
---|
36 | BLOCK_DEVICE_BUSY, |
---|
37 | BLOCK_DEVICE_READ_SUCCESS, |
---|
38 | BLOCK_DEVICE_WRITE_SUCCESS, |
---|
39 | BLOCK_DEVICE_READ_ERROR, |
---|
40 | BLOCK_DEVICE_WRITE_ERROR, |
---|
41 | BLOCK_DEVICE_ERROR, |
---|
42 | }; |
---|
43 | enum IOC_driver_modes |
---|
44 | { |
---|
45 | IOC_BOOT_PA_MODE, // No V2P translation / Polling IOC_STATUS / no access checking |
---|
46 | IOC_BOOT_VA_MODE, // V2P translation / Polling IOC_STATUS / no access checking |
---|
47 | IOC_KERNEL_MODE, // V2P translation / Descheduling + IRQ / no access checking |
---|
48 | IOC_USER_MODE, // V2P translation / Descheduling + IRQ / access checking |
---|
49 | }; |
---|
50 | |
---|
51 | /////////////////////////////////////////////////////////////////////////////////// |
---|
52 | // IOC access functions and variables (vci_block_device) |
---|
53 | /////////////////////////////////////////////////////////////////////////////////// |
---|
54 | |
---|
55 | extern unsigned int _ioc_lock; |
---|
56 | extern volatile unsigned int _ioc_status; |
---|
57 | extern volatile unsigned int _ioc_gtid; |
---|
58 | extern volatile unsigned int _ioc_iommu_ix1; |
---|
59 | extern volatile unsigned int _ioc_iommu_npages; |
---|
60 | |
---|
61 | extern unsigned int _ioc_init(); |
---|
62 | |
---|
63 | extern unsigned int _ioc_write( unsigned int mode, |
---|
64 | unsigned int lba, |
---|
65 | const void* buffer, |
---|
66 | unsigned int count ); |
---|
67 | |
---|
68 | extern unsigned int _ioc_read( unsigned int mode, |
---|
69 | unsigned int lba, |
---|
70 | void* buffer, |
---|
71 | unsigned int count ); |
---|
72 | |
---|
73 | extern unsigned int _ioc_get_status( unsigned int channel, |
---|
74 | unsigned int* status ); |
---|
75 | |
---|
76 | extern unsigned int _ioc_get_block_size(); |
---|
77 | |
---|
78 | /////////////////////////////////////////////////////////////////////////////////// |
---|
79 | |
---|
80 | |
---|
81 | #endif |
---|
82 | |
---|
83 | // Local Variables: |
---|
84 | // tab-width: 4 |
---|
85 | // c-basic-offset: 4 |
---|
86 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
87 | // indent-tabs-mode: nil |
---|
88 | // End: |
---|
89 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
90 | |
---|