Modules/UDI - Implimenting UDI support, can load udi_dpt from udiref
[tpg/acess2.git] / KernelLand / Modules / Interfaces / UDI / udi_internal.h
1 /*
2  * Acess2 UDI Layer
3  * - By John Hodge (thePowersGang)
4  *
5  * udi_internal.h
6  * - Definitions for opaque structures
7  */
8 #ifndef _UDI_INTERNAL_H_
9 #define _UDI_INTERNAL_H_
10
11 #define NEW(type,extra) (type*)calloc(sizeof(type)extra,1)
12 #define NEW_wA(type,fld,cnt)    NEW(type,+(sizeof(((type*)NULL)->fld[0])*cnt))
13
14 typedef struct sUDI_PropMessage         tUDI_PropMessage;
15 typedef struct sUDI_PropRegion  tUDI_PropRegion;
16
17 typedef struct sUDI_DriverModule        tUDI_DriverModule;
18 typedef struct sUDI_DriverInstance      tUDI_DriverInstance;
19 typedef struct sUDI_DriverRegion        tUDI_DriverRegion;
20
21 struct sUDI_PropMessage
22 {
23          int    locale;
24         udi_ubit16_t    index;
25         const char      *string;
26 };
27
28 struct sUDI_PropRegion
29 {
30         enum {
31                 UDI_REGIONTYPE_NORMAL,
32                 UDI_REGIONTYPE_FP,
33         }       Type;
34         enum {
35                 UDI_REGIONBINDING_STATIC,
36                 UDI_REGIONBINDING_DYNAMIC,
37         }       Binding;
38         enum {
39                 UDI_REGIONPRIO_MED,
40                 UDI_REGIONPRIO_LO,
41                 UDI_REGIONPRIO_HI,
42         }       Priority;
43         enum {
44                 UDI_REGIONLATENCY_NONOVERRRUNABLE,
45                 UDI_REGIONLATENCY_POWERFAIL,
46                 UDI_REGIONLATENCY_OVERRUNNABLE,
47                 UDI_REGIONLATENCY_RETRYABLE,
48                 // non_overrunable
49                 UDI_REGIONLATENCY_NONCTRITICAL,
50         }       Latency;
51         udi_ubit32_t    OverrunTime;
52
53
54 };
55
56 struct sUDI_DriverModule
57 {
58         tUDI_DriverModule       *Next;
59         void    *Base;
60
61         udi_init_t      *InitInfo;
62                 
63         const char      *ModuleName;
64          int    nMessages;
65         tUDI_PropMessage        *Messages;      // Sorted list
66         
67          int    nRegionTypes;
68         tUDI_PropRegion *RegionTypes;
69         
70          int    nSecondaryRegions;
71 };
72
73 struct sUDI_DriverInstance
74 {
75         tUDI_DriverModule       *Module;
76         udi_channel_t   ManagementChannel;
77         tUDI_DriverRegion       *Regions[];
78 };
79
80 struct sUDI_DriverRegion
81 {
82         udi_init_context_t      *InitContext;
83 };
84
85 enum eUDI_MetaLang
86 {
87         METALANG_MGMT,
88         METALANG_BUS
89 };
90
91 extern udi_channel_t    UDI_CreateChannel(enum eUDI_MetaLang metalang, udi_index_t meta_ops_num,
92         tUDI_DriverInstance *ThisEnd, udi_index_t ThisOpsIndex,
93         tUDI_DriverInstance *OtherEnd, udi_index_t OtherOpsIndex);
94
95 extern const void       *UDI_int_ChannelPrepForCall(udi_cb_t *gcb, enum eUDI_MetaLang metalang);
96
97 #endif
98

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