5.10. DIO
5.10.1. Types
Base type |
Type Name |
Brief |
---|---|---|
typedef uint32 |
type definition for identifying DIO channels (meaning single port pins) |
|
typedef uint32 |
type definition for identifying ports |
|
typedef uint8 |
type definition for status |
|
typedef uint32 |
type definition for setting port level values |
|
typedef uint8 |
type definition for setting DIO channnel level values (allowed values: STD_HIGH and STD_LOW) |
|
typedef const Dio_ChannelGroupType * |
type definition for referencing channel group structures |
5.10.1.1. typedef Dio_ChannelType
typedef uint32 Dio_ChannelType;
Brief: type definition for identifying DIO channels (meaning single port pins)
5.10.1.2. typedef Dio_PortType
typedef uint32 Dio_PortType;
Brief: type definition for identifying ports
5.10.1.3. typedef Dio_StatusType
typedef uint8 Dio_StatusType;
Brief: type definition for status
5.10.1.4. typedef Dio_PortLevelType
typedef uint32 Dio_PortLevelType;
Brief: type definition for setting port level values
This is a bitmask, where each bit with value ‘1’ sets the corresponding port pin to HIGH and ‘0’ sets the pin to LOW)
5.10.1.5. typedef Dio_LevelType
typedef uint8 Dio_LevelType;
Brief: type definition for setting DIO channnel level values (allowed values: STD_HIGH and STD_LOW)
5.10.1.6. typedef Dio_ChannelGroupRefType
typedef const Dio_ChannelGroupType* Dio_ChannelGroupRefType;
Brief: type definition for referencing channel group structures
5.10.2. Structures
Name |
Brief |
---|---|
Type definition for identifying channel groups (meaning a set of pins in one port) |
5.10.3. Defines
Name |
Brief |
---|---|
DIO_SW_MAJOR_VERSION |
Driver Implementation Major Version. |
DIO_SW_MINOR_VERSION |
Driver Implementation Minor Version. |
DIO_SW_PATCH_VERSION |
Driver Implementation Patch Version. |
DIO_AR_RELEASE_MAJOR_VERSION |
AUTOSAR Major version specification implemented by DIO Driver. |
DIO_AR_RELEASE_MINOR_VERSION |
AUTOSAR Minor version specification implemented by DIO Driver. |
DIO_AR_RELEASE_REVISION_VERSION |
AUTOSAR Patch version specification implemented by DIO Driver. |
DIO_VENDOR_ID |
Texas Instruments Vendor ID. |
DIO_MODULE_ID |
DIO Driver Module ID. |
DIO_E_PARAM_INVALID_CHANNEL_ID |
ERROR:API service called with invalid channel ID. |
DIO_E_PARAM_INVALID_PORT_ID |
ERROR:API service called with invalid port ID. |
DIO_E_PARAM_INVALID_GROUP |
ERROR:API service called with invalid channel group ID. |
DIO_E_PARAM_POINTER |
ERROR:Dio_GetVersionInfo() called with NULL_PTR as parameter. |
DIO_SID_READ_CHANNEL |
Dio_ReadChannel() |
DIO_SID_WRITE_CHANNEL |
Dio_WriteChannel() |
DIO_SID_READ_PORT |
Dio_ReadPort() |
DIO_SID_WRITE_PORT |
Dio_WritePort() |
DIO_SID_READ_CHL_GROUP |
Dio_ReadChannelGroup() |
DIO_SID_WRITE_CHL_GROUP |
Dio_WriteChannelGroup() |
DIO_SID_FLIP_CHANNEL |
Dio_FlipChannel() |
DIO_SID_GET_VERSION_INFO |
Dio_GetVersionInfo() |
DIO_SID_REGISTER_READBACK |
Dio_RegisterReadback() |
DIO_RETURN_ZERO |
To Return 0 when Improper ID is passed to Read functions. |
5.10.4. Functions
Return type |
Function Name |
Brief |
---|---|---|
Dio_ReadChannel(Dio_ChannelType ChannelId) |
Returns the value of the specified DIO channel. |
|
void |
Dio_WriteChannel(Dio_ChannelType ChannelId, Dio_LevelType Level) |
Service to set a level of a channel. |
Dio_ReadPort(Dio_PortType PortId) |
Returns the level of all channels of that port. |
|
void |
Dio_WritePort(Dio_PortType PortId, Dio_PortLevelType Level) |
Service to set a value of the port. |
Dio_ReadChannelGroup(Dio_ChannelGroupRefType ChannelGroupIdPtr) |
This Service reads a subset of the adjoining bits of a port. |
|
void |
Dio_WriteChannelGroup(Dio_ChannelGroupRefType ChannelGroupIdPtr, Dio_PortLevelType Level) |
Service to set a subset of the adjoining bits of a port to a specified level. |
void |
Dio_GetVersionInfo(Std_VersionInfoType * versioninfo) |
Service to get the version information of this module. |
Dio_FlipChannel(Dio_ChannelType ChannelId) |
Service to flip (change from 1 to 0 or from 0 to 1) the level of a channel and return the level of the channel after flip. |
|
Std_ReturnType |
Dio_RegisterReadback(Dio_RegisterReadbackType * RegRbPtr) |
This function reads the important registers of the hardware unit and returns the value in the structure. |
5.10.4.1. function Dio_ReadChannel
Dio_LevelType Dio_ReadChannel(
Dio_ChannelType ChannelId
)
Brief: Returns the value of the specified DIO channel.
Service ID[hex] - 0x00
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
ChannelId - ID of DIO channel
Returns:
STD_HIGH - The physical level of the corresponding Pin is STD_HIGH
STD_LOW - The physical level of the corresponding Pin is STD_LOW
Return: Dio_LevelType
5.10.4.2. function Dio_WriteChannel
void Dio_WriteChannel(
Dio_ChannelType ChannelId,
Dio_LevelType Level
)
Brief: Service to set a level of a channel.
Service ID[hex] - 0x01
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
ChannelId - ID of DIO channel
Level - Value to be written
Returns:
None
Return: None
5.10.4.3. function Dio_ReadPort
Dio_PortLevelType Dio_ReadPort(
Dio_PortType PortId
)
Brief: Returns the level of all channels of that port.
Service ID[hex] - 0x02
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
PortId - ID of DIO Port
Returns:
Level of all channels of that port
Return: Dio_PortLevelType
5.10.4.4. function Dio_WritePort
void Dio_WritePort(
Dio_PortType PortId,
Dio_PortLevelType Level
)
Brief: Service to set a value of the port.
Service ID[hex] - 0x03
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
PortId - ID of DIO Port
Level - Value to be written
Returns:
None
Return: None
5.10.4.5. function Dio_ReadChannelGroup
Dio_PortLevelType Dio_ReadChannelGroup(
Dio_ChannelGroupRefType ChannelGroupIdPtr
)
Brief: This Service reads a subset of the adjoining bits of a port.
Service ID[hex] - 0x04
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
ChannelGroupIdPtr - Pointer to ChannelGroup
Returns:
Level of a subset of the adjoining bits of a port
Return: Dio_PortLevelType
5.10.4.6. function Dio_WriteChannelGroup
void Dio_WriteChannelGroup(
Dio_ChannelGroupRefType ChannelGroupIdPtr,
Dio_PortLevelType Level
)
Brief: Service to set a subset of the adjoining bits of a port to a specified level.
Service ID[hex] - 0x05
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
ChannelGroupIdPtr - Pointer to ChannelGroup
Level - Value to be written
Returns:
None
Return: None
5.10.4.7. function Dio_GetVersionInfo
void Dio_GetVersionInfo(
Std_VersionInfoType * versioninfo
)
Brief: Service to get the version information of this module.
Service ID[hex] - 0x12
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
versioninfo - Pointer to where to store the version information of this module.
Returns:
None
Return: None
5.10.4.8. function Dio_FlipChannel
Dio_LevelType Dio_FlipChannel(
Dio_ChannelType ChannelId
)
Brief: Service to flip (change from 1 to 0 or from 0 to 1) the level of a channel and return the level of the channel after flip.
Service ID[hex] - 0x11
Sync/Async - Synchronous
Reentrancy - Reentrant
Parameters:
ChannelId - ID of DIO channel
Returns:
STD_HIGH - The physical level of the corresponding Pin is STD_HIGH
STD_LOW - The physical level of the corresponding Pin is STD_LOW
Return: Dio_LevelType
5.10.4.9. function Dio_RegisterReadback
Std_ReturnType Dio_RegisterReadback(
Dio_RegisterReadbackType * RegRbPtr
)
Brief: This function reads the important registers of the hardware unit and returns the value in the structure.
This API is used to check the status of critical registers which do not change during program execution.
Service ID[hex] - 0x19
Sync/Async - Synchronous
Reentrancy - Reentrant
This function reads the important registers of the hardware unit and returns the value in the structure.
Parameters:
RegRbPtr - Pointer to where to store the readback values. If this pointer is NULL, then the API will return E_NOT_OK.
Returns:
E_OK - Register read back has been done successfully
E_NOT_OK - Register read back failed
Return: Std_ReturnType