source: soft/giet_vm/giet_drivers/bdv_driver.h @ 350

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

Introducing two modifications regarding the locks protecting
exclusive access to BDV and TTY peripherals channels:

  • use the giet_lock_t type to have only one lock per cache line.
  • store these locks in the seg_kernel_data or in seg_kernel_uncdata, depending on the GIET_NO HARD_CC configuration parameter, to have cacheable locks when it is possible.
File size: 2.7 KB
Line 
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
9#ifndef _GIET_BDV_DRIVER_H_
10#define _GIET_BDV_DRIVER_H_
11
12#include "utils.h"
13
14///////////////////////////////////////////////////////////////////////////////////
15// BDV global variables
16///////////////////////////////////////////////////////////////////////////////////
17
18extern giet_lock_t           _bdv_lock;    // BDV is a shared ressource
19extern volatile unsigned int _bdv_status;  // required for IRQ signaling
20extern volatile unsigned int _bdv_gtid;    // descheduled task id = gpid<<16 + ltid
21
22///////////////////////////////////////////////////////////////////////////////////
23// BDV registers, operations and status values
24///////////////////////////////////////////////////////////////////////////////////
25
26enum 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};
38
39enum BDV_operations
40{
41    BLOCK_DEVICE_NOOP,
42    BLOCK_DEVICE_READ,
43    BLOCK_DEVICE_WRITE,
44};
45
46enum 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};
56
57///////////////////////////////////////////////////////////////////////////////////
58// BDV access functions (vci_block_device)
59///////////////////////////////////////////////////////////////////////////////////
60
61extern unsigned int _bdv_init();
62
63extern unsigned int _bdv_write( unsigned int       mode,
64                                unsigned int       lba, 
65                                unsigned long long buffer, 
66                                unsigned int       count );
67
68extern unsigned int _bdv_read(  unsigned int       mode,
69                                unsigned int       lba, 
70                                unsigned long long buffer,
71                                unsigned int       count );
72
73extern unsigned int _bdv_get_status();
74
75extern unsigned int _bdv_get_block_size();
76
77extern void _bdv_isr( unsigned irq_type,
78                      unsigned irq_id,
79                      unsigned channel );
80
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
Note: See TracBrowser for help on using the repository browser.