UDI Environment: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
Partial revert - There should be no semicolons after #includes
→‎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
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.
 
<source lang="C">
1. '''typedef unsigned char uint8_t udi_ubit8_t''';
2. '''typedef unsigned short uint16_t udi_ubit16_t''';
3. '''typedef unsigned int uint32_t udi_ubit32_t ''';
4. '''typedef char int8_t udi_sbit8_t''';
5. '''typedef short int16_t udi_sbit16_t''';
6. '''typedef int int32_t udi_sbit32_t''';
typedef bool udi_bool_t;
</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.
2. '''typedef unsigned short udi_ubit16_t'''
 
3. '''typedef unsigned int udi_ubit32_t '''
 
4. '''typedef char udi_sbit8_t'''
 
5. '''typedef short udi_sbit16_t'''
 
6. '''typedef int udi_sbit32_t'''
 
7. '''typedef udi_ubit8_t udi_boolean_t'''
 
Driver must use these types at least while passing arguments and returning variables. They can '''internally use the ISO C types''' because that doesn't affect compatibility. For example, the long type is useful for getting the most optimized type for the architecture.
 
==== Abstract Types ====