UDI Environment: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
→‎Specific-length Types: Not really sure I see the point in these typedefs? Either way, I made them use the stdint types so that the widths are constant between archs
m Bot: Replace deprecated source tag with syntaxhighlight
 
(2 intermediate revisions by 2 users not shown)
Line 22:
The Uniform Driver Interface declares specific-length types for use in arithmetic and logical operations. They have fixed lengths that don't change between different platforms.
 
<sourcesyntaxhighlight lang="C">
typedef uint8_t udi_ubit8_t;
typedef uint16_t udi_ubit16_t;
Line 30:
typedef int32_t udi_sbit32_t;
typedef bool udi_bool_t;
</syntaxhighlight>
</source>
 
The driver must use these types while passing arguments and returning variables. They can also use the fast ints instead of the fixed width ones.
Line 44:
It must have at least 16 bits in size, for following guidelines.
 
<sourcesyntaxhighlight lang="C">
typedef <INTEGRAL TYPE> udi_size_t;
</syntaxhighlight>
</source>
 
===== Index Type =====
Line 54:
I think is type need not have a 1 byte size as the UDI environment '''may encrypt''' the index to hide it from the driver (information presented in this statement is not guaranteed).
 
<sourcesyntaxhighlight lang="C">
typedef <INTEGRAL TYPE> udi_index_t;
</syntaxhighlight>
</source>
 
'''i) Control Block Index'''
Line 92:
'''i) Channels & udi_channel_t'''
 
'''File''' - <sourcesyntaxhighlight lang="C">#include "udi.h"</sourcesyntaxhighlight>
'''Declaration''' - <sourcesyntaxhighlight lang="C">typedef <HANDLE> udi_channel_t;</sourcesyntaxhighlight>
'''NullHandle''' - <sourcesyntaxhighlight lang="C">#define UDI_NULL_CHANNEL <NULL HANDLE VALUE></sourcesyntaxhighlight>
 
'''udi_channel_t''' is used to refer to UDI Channels (described on another page) and are '''transferrable opaque handles'''. They are used for bi-directional communication between different drivers and with the environment.
Line 100:
'''ii) Buffer Path Routing Handle & udi_buf_path_t'''
 
'''File''' - <sourcesyntaxhighlight lang="C">#include "udi.h"</sourcesyntaxhighlight>
'''Declaration''' - <sourcesyntaxhighlight lang="C">typedef <HANDLE> udi_buf_path_t;</sourcesyntaxhighlight>
'''NullHandle''' - <sourcesyntaxhighlight lang="C">#define UDI_NULL_BUF_PATH <NULL HANDLE VALUE></sourcesyntaxhighlight>
 
All UDI buffers are associated with buffer path handles. They indicate destinations for incoming data and are explicitly allocated by the driver. They are '''not transferable between regions'''.
Line 108:
'''iii) Origin Handles & udi_origin_handle_t'''
 
'''File''' - <sourcesyntaxhighlight lang="C">#include "udi.h"</sourcesyntaxhighlight>
'''Declaration''' - <sourcesyntaxhighlight lang="C">typedef <HANDLE> udi_origin_handle_t;</sourcesyntaxhighlight>
'''NullHandle''' - <sourcesyntaxhighlight lang="C">#define UDI_NULL_ORIGIN <NULL HANDLE VALUE></sourcesyntaxhighlight>
 
Environments should use '''origin handles''' to hold information about origination of user requests. UDI drivers are responsible for copying the origin handle from received control blocks into control blocks generated on behalf of that control block. This is used by the environment to track quota usage, resource distribution, etc. in the system.
Line 124:
'''i) Timestamp Type''' - This is used to refer to a point in time and is relative to a starting point that is implementation defined. The driver cannot make use of it on its own and it is for determining relative differences in time. The implementation should use the '''kernel-timestamp''' maintained by the kernel for scheduling use. It should be able to do so effectively by mapping the time variable in user-space itself.
 
<sourcesyntaxhighlight lang="C">typedef <OPAQUE TYPE> udi_timestamp_t;</sourcesyntaxhighlight>
 
=== Semi-Opaque Types ===
Line 156:
This type is used for providing a uniform method of reporting status or error within the I/O system.
 
'''File''' - <sourcesyntaxhighlight lang="C">#include <udi.h></sourcesyntaxhighlight>
'''Declaration''' - <sourcesyntaxhighlight lang="C">typedef udi_ubit32_t udi_status_t;</sourcesyntaxhighlight>
'''MaskValues & Flags''' -
<sourcesyntaxhighlight lang="C">
#define UDI_STATUS_CODE_MASK 0x0000FFFF
#define UDI_STAT_META_SPECIFIC 0x00008000
Line 165:
#define UDI_CORRELATE_OFFSET 0x16
#define UDI_CORRELATE_MASK 0xFFFF0000
</syntaxhighlight>
</source>
'''StatusValues''' -
<sourcesyntaxhighlight lang="C">
#define UDI_OK 0 // request was successfully completed without any errors
#define UDI_STAT_NOT_SUPPORTED 1 // this operation is not supported or given parameters are not handled by the environment
Line 189:
#define UDI_STAT_TERMINATED 19 // request ended abruptly due to termination of the region without notice
#define UDI_STAT_ATTR_MISMATCH 20 // the driver has been given a custom attribute that it cannot apply on its device
</syntaxhighlight>
</source>
 
UDI Status is a 32-bit type composed of two separate 16-bit values as seen in the two different sets of macros given. They are ''''status code'''' field and a ''''correlation field''''.
Line 196:
 
The STATUS_CODE_MASK is used for filtering out the correlation field and getting out the status field. The UDI_STAT_META_SPECIFIC macro is used for telling that the '''status code used is not of the common status codes given and is meta-language specific'''. Those are not defined here, not.
 
[[Category:Uniform Driver Interface]]