CMSIS-Driver
Version 2.8.0
Peripheral Interface for Middleware and Application Code
|
API for Virtual I/O (VIO) (cmsis_vio.h) More...
Content | |
Defines and Structs | |
Documents the defines and structs of the VIO API. | |
Functions | |
void | vioInit (void) |
Initialize test input, output. More... | |
int32_t | vioPrint (uint32_t level, const char *format,...) |
Print formated string to test terminal. More... | |
void | vioSetSignal (uint32_t mask, uint32_t signal) |
Set signal output. More... | |
uint32_t | vioGetSignal (uint32_t mask) |
Get signal input. More... | |
void | vioSetValue (uint32_t id, int32_t value) |
Set value output. More... | |
int32_t | vioGetValue (uint32_t id) |
Get value input. More... | |
void | vioSetXYZ (uint32_t id, vioValueXYZ_t valueXYZ) |
Set XYZ value output. More... | |
vioValueXYZ_t | vioGetXYZ (uint32_t id) |
Get XYZ value input. More... | |
void | vioSetIPv4 (uint32_t id, vioAddrIPv4_t addrIPv4) |
Set IPv4 address output. More... | |
vioAddrIPv4_t | vioGetIPv4 (uint32_t id) |
Get IPv4 address input. More... | |
void | vioSetIPv6 (uint32_t id, vioAddrIPv6_t addrIPv6) |
Set IPv6 address output. More... | |
vioAddrIPv6_t | vioGetIPv6 (uint32_t id) |
Get IPv6 address from peripheral. More... | |
API for Virtual I/O (VIO) (cmsis_vio.h)
The VIO software component is a virtual I/O abstraction for peripherals that are typically used in example projects. It enables developers to move from an evaluation kit to custom hardware and helps to scale project examples at large to many development boards:
VIO API
The following header file defines the Application Programming Interface (API) for VIO:
VIO User Code Templates
The VIO software component contains two user code templates with different purposes:
VIO Memory Location Structure
For testing purposes, it is required to have fixed memory locations that are used to read/store values. In the VIO:Virtual template file (vio.c), an exemplary implementation is shown:
Use these memory locations to monitor or set the variables as required in the application.
Two defines are available that help to disconnect the actual peripherals and enable virtual I/Os: CMSIS_VIN
and CMSIS_VOUT
. They help to write code that can be used in testing environments without real hardware access. The following implementation example shows such code:
Code Example (VIO Implementation)
Memory display in IDEs
Arm Keil MDK uses the provided SCVD file to display the VIO signals in Component Viewer:
void vioInit | ( | void | ) |
Initialize test input, output.
The function vioInit initializes the VIO interface. Use it to initialize any connected hardware that is used to map VIO signals.
Code Example:
int32_t vioPrint | ( | uint32_t | level, |
const char * | format, | ||
... | |||
) |
Print formated string to test terminal.
[in] | level | level (vioLevel...). |
[in] | format | formated string to print. |
[in] | ... | optional arguments (depending on format string). |
The function vioPrint prints a formatted string to a test terminal. Formatting of the output follows the rules of standard C language printf().
Refer to Print Levels for information about the possible levels.
Code Example:
void vioSetSignal | ( | uint32_t | mask, |
uint32_t | signal | ||
) |
Set signal output.
[in] | mask | bit mask of signals to set. |
[in] | signal | signal value to set. |
The function vioSetSignal set a signal to an output specified by mask. Use this function to map VIOs to actual hardware for displaying signals on a target board.
Refer to Signals for information about the possible mask and signal values.
Code Example:
uint32_t vioGetSignal | ( | uint32_t | mask | ) |
Get signal input.
[in] | mask | bit mask of signals to read. |
The function vioGetSignal retrieves a signal from an input identified by mask. Use this function to read data from any input that is provided.
Refer to Signals for information about the possible mask values.
Code Example:
void vioSetValue | ( | uint32_t | id, |
int32_t | value | ||
) |
Set value output.
[in] | id | output identifier. |
[in] | value | value to set. |
The function vioSetValue set the value to the output identified by id. Use this function to set states of I/Os for example.
Refer to Values for information about value and IDs for id.
Code Example:
int32_t vioGetValue | ( | uint32_t | id | ) |
Get value input.
[in] | id | input identifier. |
The function vioGetValue retrieves a value from the input identified by id. Use this function to read data from inputs.
Refer to IDs for information about id.
Code Example:
void vioSetXYZ | ( | uint32_t | id, |
vioValueXYZ_t | valueXYZ | ||
) |
Set XYZ value output.
[in] | id | output identifier. |
[in] | valueXYZ | XYZ data to set. |
The function vioSetXYZ sets a three-dimensional value valueXYZ to the output identified by id. Use this function to apply a 3d value to an output.
Refer to Values for information about the valueXYZ and IDs for id.
Code Example:
vioValueXYZ_t vioGetXYZ | ( | uint32_t | id | ) |
Get XYZ value input.
[in] | id | input identifier. |
The function vioGetXYZ retrieves a three-dimensional value from the input identified by id. Use this function to get a 3d value.
Refer to IDs for information about id.
Code Example:
void vioSetIPv4 | ( | uint32_t | id, |
vioAddrIPv4_t | addrIPv4 | ||
) |
Set IPv4 address output.
[in] | id | output identifier. |
[in] | addrIPv4 | pointer to IPv4 address. |
The function vioSetIPv4 sets an IPv4 address specified by addrIPv4 to an interface identified by id. Use this function to assign an IPv4 address to an interface.
Refer to IDs for information about id and IP Addresses for addrIPv4.
Code Example:
vioAddrIPv4_t vioGetIPv4 | ( | uint32_t | id | ) |
Get IPv4 address input.
[in] | id | input identifier. |
The function vioGetIPv4 retrieves the IPv4 addrIPv4 from an interface identified by id. Use this function to read an IPv4 address.
Refer to IDs for information about id.
Code Example:
void vioSetIPv6 | ( | uint32_t | id, |
vioAddrIPv6_t | addrIPv6 | ||
) |
Set IPv6 address output.
[in] | id | output identifier. |
[in] | addrIPv6 | pointer to IPv6 address. |
The function vioSetIPv6 sets an IPv6 address specified by addrIPv6 to an interface identified by id. Use this function to assign an IPv6 address to an interface.
Refer to IDs for information about id and IP Addresses for addrIPv6.
Code Example:
vioAddrIPv6_t vioGetIPv6 | ( | uint32_t | id | ) |
Get IPv6 address from peripheral.
[in] | id | input identifier. |
The function vioGetIPv6 retrieves the IPv6 addrIPv6 from an interface identified by id. Use this function to read an IPv6 address.
Refer to IDs for information about id.
Code Example: