Modules/UDI - Moved UDI headers to /UDI/include
[tpg/acess2.git] / UDI / include / udi_physio.h
1 /**
2  * \file udi_physio.h
3  */
4 #ifndef _UDI_PHYSIO_H_
5 #define _UDI_PHYSIO_H_
6
7 #include <udi.h>
8
9 //#ifndef UDI_PHYSIO_VERSION
10 //# error "UDI_PHYSIO_VERSION must be defined"
11 //#endif
12
13 // === TYPEDEFS ===
14 // DMA Core
15 typedef _udi_handle_t   udi_dma_handle_t;
16 #define UDI_NULL_DMA_HANDLE     _NULL_HANDLE
17 typedef uint64_t        udi_busaddr64_t;        //!< \note Opaque
18 typedef struct udi_scgth_element_32_s   udi_scgth_element_32_t;
19 typedef struct udi_scgth_element_64_s   udi_scgth_element_64_t;
20 typedef struct udi_scgth_s      udi_scgth_t;
21 typedef _udi_handle_t   udi_dma_constraints_t;
22 #define UDI_NULL_DMA_CONSTRAINTS        _NULL_HANDLE
23 /**
24  * \name DMA constraints attributes
25  * \{
26  */
27 typedef udi_ubit8_t udi_dma_constraints_attr_t;
28 /* DMA Convenience Attribute Codes */
29 #define UDI_DMA_ADDRESSABLE_BITS          100
30 #define UDI_DMA_ALIGNMENT_BITS            101
31 /* DMA Constraints on the Entire Transfer */
32 #define UDI_DMA_DATA_ADDRESSABLE_BITS     110
33 #define UDI_DMA_NO_PARTIAL                111
34 /* DMA Constraints on the Scatter/Gather  List */
35 #define UDI_DMA_SCGTH_MAX_ELEMENTS        120
36 #define UDI_DMA_SCGTH_FORMAT              121
37 #define UDI_DMA_SCGTH_ENDIANNESS          122
38 #define UDI_DMA_SCGTH_ADDRESSABLE_BITS    123
39 #define UDI_DMA_SCGTH_MAX_SEGMENTS        124
40 /* DMA Constraints on Scatter/Gather Segments */
41 #define UDI_DMA_SCGTH_ALIGNMENT_BITS      130
42 #define UDI_DMA_SCGTH_MAX_EL_PER_SEG      131
43 #define UDI_DMA_SCGTH_PREFIX_BYTES        132
44 /* DMA Constraints on Scatter/Gather Elements */
45 #define UDI_DMA_ELEMENT_ALIGNMENT_BITS    140
46 #define UDI_DMA_ELEMENT_LENGTH_BITS       141
47 #define UDI_DMA_ELEMENT_GRANULARITY_BITS 142
48 /* DMA Constraints for Special Addressing */
49 #define UDI_DMA_ADDR_FIXED_BITS           150
50 #define UDI_DMA_ADDR_FIXED_TYPE           151
51 #define UDI_DMA_ADDR_FIXED_VALUE_LO       152
52 #define UDI_DMA_ADDR_FIXED_VALUE_HI       153
53 /* DMA Constraints on DMA Access Behavior */
54 #define UDI_DMA_SEQUENTIAL                160
55 #define UDI_DMA_SLOP_IN_BITS              161
56 #define UDI_DMA_SLOP_OUT_BITS             162
57 #define UDI_DMA_SLOP_OUT_EXTRA            163
58 #define UDI_DMA_SLOP_BARRIER_BITS         164
59 /* Values for UDI_DMA_SCGTH_ENDIANNESS */
60 #define UDI_DMA_LITTLE_ENDIAN             (1U<<6)
61 #define UDI_DMA_BIG_ENDIAN                (1U<<5)
62 /* Values for UDI_DMA_ADDR_FIXED_TYPE */
63 #define UDI_DMA_FIXED_ELEMENT             1
64 /**
65  * \}
66  */
67 // DMA Constraints Management
68 typedef struct udi_dma_constraints_attr_spec_s  udi_dma_constraints_attr_spec_t;
69 typedef void udi_dma_constraints_attr_set_call_t(
70         udi_cb_t *gcb, udi_dma_constraints_t new_constraints, udi_status_t status
71         );
72 typedef struct udi_dma_limits_s udi_dma_limits_t;
73
74
75 // === STRUCTURES ===
76 // --- DMA Constraints Management ---
77 struct udi_dma_constraints_attr_spec_s
78 {
79      udi_dma_constraints_attr_t attr_type;
80      udi_ubit32_t       attr_value;
81 };
82 // --- DMA Core ---
83 struct udi_dma_limits_s
84 {
85      udi_size_t max_legal_contig_alloc;
86      udi_size_t max_safe_contig_alloc;
87      udi_size_t cache_line_size;
88 };
89 struct udi_scgth_element_32_s
90 {
91      udi_ubit32_t       block_busaddr;
92      udi_ubit32_t       block_length;
93 };
94 struct udi_scgth_element_64_s
95 {
96      udi_busaddr64_t    block_busaddr;
97      udi_ubit32_t       block_length;
98      udi_ubit32_t       el_reserved;
99 };
100 /* Extension Flag */
101 #define UDI_SCGTH_EXT                    0x80000000
102 struct udi_scgth_s
103 {
104      udi_ubit16_t       scgth_num_elements;
105      udi_ubit8_t        scgth_format;
106      udi_boolean_t      scgth_must_swap;
107      union {
108           udi_scgth_element_32_t        *el32p;
109           udi_scgth_element_64_t        *el64p;
110      }  scgth_elements;
111      union {
112           udi_scgth_element_32_t        el32;
113           udi_scgth_element_64_t        el64;
114      }  scgth_first_segment;
115 };
116 /* Values for scgth_format */
117 #define UDI_SCGTH_32                     (1U<<0)
118 #define UDI_SCGTH_64                     (1U<<1)
119 #define UDI_SCGTH_DMA_MAPPED             (1U<<6)
120 #define UDI_SCGTH_DRIVER_MAPPED          (1U<<7)
121
122
123
124 // === FUNCTIONS ===
125 #include <physio/dma_const.h>
126 #include <physio/dma.h>
127 #include <physio/meta_intr.h>
128 #include <physio/meta_bus.h>
129 #include "physio/pio.h"
130
131 #include "physio/pci.h"
132
133 #endif

UCC git Repository :: git.ucc.asn.au