A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://arm-software.github.io/CMSIS_5/Driver/html/group__vio__interface__gr.html below:

VIO

API for Virtual I/O (VIO) (cmsis_vio.h) 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:

Virtual I/O provides a generic API for examples and testing

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:

__USED uint32_t vioSignalIn;

__USED uint32_t vioSignalOut;

__USED char vioPrintMem[VIO_PRINTMEM_NUM][VIO_PRINT_MAX_SIZE];

__USED int32_t vioValue [VIO_VALUE_NUM];

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)

uint32_t i;

#if !defined CMSIS_VIN

#endif

#if !defined CMSIS_VOUT

#endif

vioSignalIn = 0U;

vioSignalOut = 0U;

memset (vioPrintMem, 0, sizeof(vioPrintMem));

memset (vioValue, 0, sizeof(vioValue));

memset (vioValueXYZ, 0, sizeof(vioValueXYZ));

memset (vioAddrIPv4, 0, sizeof(vioAddrIPv4));

memset (vioAddrIPv6, 0, sizeof(vioAddrIPv6));

#if !defined CMSIS_VOUT

BSP_LED_Init(LED_BLUE);

BSP_LED_Init(LED_RED);

BSP_LED_Init(LED_GREEN);

#endif

#if !defined CMSIS_VIN

BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);

#endif

return;

}

Memory display in IDEs

Arm Keil MDK uses the provided SCVD file to display the VIO signals in Component Viewer:

Initialize test input, output.

Returns
none.

The function vioInit initializes the VIO interface. Use it to initialize any connected hardware that is used to map VIO signals.

Code Example:

int main (void) {

SystemCoreClockUpdate();

}

int32_t vioPrint ( uint32_t  level, const char *  format,   ...  )

Print formated string to test terminal.

Parameters
[in] level level (vioLevel...). [in] format formated string to print. [in] ... optional arguments (depending on format string).
Returns
number of characters written or -1 in case of error.

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:

int main (void) {

int x = 3;

}

void vioSetSignal ( uint32_t  mask, uint32_t  signal  )

Set signal output.

Parameters
[in] mask bit mask of signals to set. [in] signal signal value to set.
Returns
none.

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.

Parameters
[in] mask bit mask of signals to read.
Returns
signal value.

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:

int main (void) {

uint32_t state;

uint32_t last = 0U;

for (;;) {

if (state != last){

}

}

last = state;

}

}

void vioSetValue ( uint32_t  id, int32_t  value  )

Set value output.

Parameters
[in] id output identifier. [in] value value to set.
Returns
none.

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.

Parameters
[in] id input identifier.
Returns
value retrieved from input.

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:

int main (void) {

uint32_t button;

}

Set XYZ value output.

Parameters
[in] id output identifier. [in] valueXYZ XYZ data to set.
Returns
none.

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:

Get XYZ value input.

Parameters
[in] id input identifier.
Returns
XYZ data retrieved from XYZ peripheral.

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:

Set IPv4 address output.

Parameters
[in] id output identifier. [in] addrIPv4 pointer to IPv4 address.
Returns
none.

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:

Get IPv4 address input.

Parameters
[in] id input identifier.
Returns
IPv4 address retrieved from peripheral.

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:

Set IPv6 address output.

Parameters
[in] id output identifier. [in] addrIPv6 pointer to IPv6 address.
Returns
none.

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:

int main (void) {

9U, 10U, 11U, 12U, 13U, 14U, 15U, 16U};

}

Get IPv6 address from peripheral.

Parameters
[in] id input identifier.
Returns
IPv6 address retrieved from peripheral.

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:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4