1 /******************************************************************************
3 * @brief CMSIS Virtual I/O header file
6 ******************************************************************************/
8 * Copyright (c) 2019-2023 Arm Limited. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
30 /*******************************************************************************
31 * Generic I/O mapping recommended for CMSIS-VIO
32 * Note: not every I/O must be physically available
35 // vioSetSignal: mask values
36 #define vioLED0 (1U << 0) ///< \ref vioSetSignal \a mask parameter: LED 0 (for 3-color: red)
37 #define vioLED1 (1U << 1) ///< \ref vioSetSignal \a mask parameter: LED 1 (for 3-color: green)
38 #define vioLED2 (1U << 2) ///< \ref vioSetSignal \a mask parameter: LED 2 (for 3-color: blue)
39 #define vioLED3 (1U << 3) ///< \ref vioSetSignal \a mask parameter: LED 3
40 #define vioLED4 (1U << 4) ///< \ref vioSetSignal \a mask parameter: LED 4
41 #define vioLED5 (1U << 5) ///< \ref vioSetSignal \a mask parameter: LED 5
42 #define vioLED6 (1U << 6) ///< \ref vioSetSignal \a mask parameter: LED 6
43 #define vioLED7 (1U << 7) ///< \ref vioSetSignal \a mask parameter: LED 7
45 // vioSetSignal: signal values
46 #define vioLEDon (0xFFU) ///< \ref vioSetSignal \a signal parameter: pattern to turn any LED on
47 #define vioLEDoff (0x00U) ///< \ref vioSetSignal \a signal parameter: pattern to turn any LED off
49 // vioGetSignal: mask values and return values
50 #define vioBUTTON0 (1U << 0) ///< \ref vioGetSignal \a mask parameter: Push button 0
51 #define vioBUTTON1 (1U << 1) ///< \ref vioGetSignal \a mask parameter: Push button 1
52 #define vioBUTTON2 (1U << 2) ///< \ref vioGetSignal \a mask parameter: Push button 2
53 #define vioBUTTON3 (1U << 3) ///< \ref vioGetSignal \a mask parameter: Push button 3
54 #define vioJOYup (1U << 4) ///< \ref vioGetSignal \a mask parameter: Joystick button: up
55 #define vioJOYdown (1U << 5) ///< \ref vioGetSignal \a mask parameter: Joystick button: down
56 #define vioJOYleft (1U << 6) ///< \ref vioGetSignal \a mask parameter: Joystick button: left
57 #define vioJOYright (1U << 7) ///< \ref vioGetSignal \a mask parameter: Joystick button: right
58 #define vioJOYselect (1U << 8) ///< \ref vioGetSignal \a mask parameter: Joystick button: select
59 #define vioJOYall (vioJOYup | \
63 vioJOYselect) ///< \ref vioGetSignal \a mask Joystick button: all
65 // vioSetValue / vioGetValue: id values
66 #define vioAIN0 (0U) ///< \ref vioSetValue / \ref vioGetValue \a id parameter: Analog input value 0
67 #define vioAIN1 (1U) ///< \ref vioSetValue / \ref vioGetValue \a id parameter: Analog input value 1
68 #define vioAIN2 (2U) ///< \ref vioSetValue / \ref vioGetValue \a id parameter: Analog input value 2
69 #define vioAIN3 (3U) ///< \ref vioSetValue / \ref vioGetValue \a id parameter: Analog input value 3
70 #define vioAOUT0 (4U) ///< \ref vioSetValue / \ref vioGetValue \a id parameter: Analog output value 0
77 /// Initialize test input, output.
80 /// Set signal output.
81 /// \param[in] mask bit mask of signals to set.
82 /// \param[in] signal signal value to set.
83 void vioSetSignal (uint32_t mask, uint32_t signal);
86 /// \param[in] mask bit mask of signals to read.
87 /// \return signal value.
88 uint32_t vioGetSignal (uint32_t mask);
91 /// \param[in] id output identifier.
92 /// \param[in] value value to set.
93 void vioSetValue (uint32_t id, int32_t value);
96 /// \param[in] id input identifier.
97 /// \return value retrieved from input.
98 int32_t vioGetValue (uint32_t id);
104 #endif /* __CMSIS_VIO_H */