diff options
Diffstat (limited to 'lib/chibios/os/hal/templates/hal_sio_lld.c')
-rw-r--r-- | lib/chibios/os/hal/templates/hal_sio_lld.c | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/templates/hal_sio_lld.c b/lib/chibios/os/hal/templates/hal_sio_lld.c new file mode 100644 index 000000000..d53ec6e54 --- /dev/null +++ b/lib/chibios/os/hal/templates/hal_sio_lld.c | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file hal_sio_lld.c | ||
19 | * @brief PLATFORM SIO subsystem low level driver source. | ||
20 | * | ||
21 | * @addtogroup SIO | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #include "hal.h" | ||
26 | |||
27 | #if (HAL_USE_SIO == TRUE) || defined(__DOXYGEN__) | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver local definitions. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver exported variables. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief SIO1 driver identifier. | ||
39 | */ | ||
40 | #if (PLATFORM_SIO_USE_SIO1 == TRUE) || defined(__DOXYGEN__) | ||
41 | SIODriver SIOD1; | ||
42 | #endif | ||
43 | |||
44 | /*===========================================================================*/ | ||
45 | /* Driver local variables and types. */ | ||
46 | /*===========================================================================*/ | ||
47 | |||
48 | /*===========================================================================*/ | ||
49 | /* Driver local functions. */ | ||
50 | /*===========================================================================*/ | ||
51 | |||
52 | /*===========================================================================*/ | ||
53 | /* Driver interrupt handlers. */ | ||
54 | /*===========================================================================*/ | ||
55 | |||
56 | /*===========================================================================*/ | ||
57 | /* Driver exported functions. */ | ||
58 | /*===========================================================================*/ | ||
59 | |||
60 | /** | ||
61 | * @brief Low level SIO driver initialization. | ||
62 | * | ||
63 | * @notapi | ||
64 | */ | ||
65 | void sio_lld_init(void) { | ||
66 | |||
67 | #if PLATFORM_SIO_USE_SIO1 == TRUE | ||
68 | /* Driver initialization.*/ | ||
69 | sioObjectInit(&SIOD1); | ||
70 | #endif | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * @brief Configures and activates the SIO peripheral. | ||
75 | * | ||
76 | * @param[in] siop pointer to the @p SIODriver object | ||
77 | * | ||
78 | * @notapi | ||
79 | */ | ||
80 | void sio_lld_start(SIODriver *siop) { | ||
81 | |||
82 | if (siop->state == SIO_STOP) { | ||
83 | /* Enables the peripheral.*/ | ||
84 | #if PLATFORM_SIO_USE_SIO1 == TRUE | ||
85 | if (&SIOD1 == siop) { | ||
86 | |||
87 | } | ||
88 | #endif | ||
89 | } | ||
90 | /* Configures the peripheral.*/ | ||
91 | |||
92 | } | ||
93 | |||
94 | /** | ||
95 | * @brief Deactivates the SIO peripheral. | ||
96 | * | ||
97 | * @param[in] siop pointer to the @p SIODriver object | ||
98 | * | ||
99 | * @notapi | ||
100 | */ | ||
101 | void sio_lld_stop(SIODriver *siop) { | ||
102 | |||
103 | if (siop->state == SIO_READY) { | ||
104 | /* Resets the peripheral.*/ | ||
105 | |||
106 | /* Disables the peripheral.*/ | ||
107 | #if PLATFORM_SIO_USE_SIO1 == TRUE | ||
108 | if (&SIOD1 == siop) { | ||
109 | |||
110 | } | ||
111 | #endif | ||
112 | } | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * @brief Control operation on a serial port. | ||
117 | * | ||
118 | * @param[in] siop pointer to the @p SIODriver object | ||
119 | * @param[in] operation control operation code | ||
120 | * @param[in,out] arg operation argument | ||
121 | * | ||
122 | * @return The control operation status. | ||
123 | * @retval MSG_OK in case of success. | ||
124 | * @retval MSG_TIMEOUT in case of operation timeout. | ||
125 | * @retval MSG_RESET in case of operation reset. | ||
126 | * | ||
127 | * @notapi | ||
128 | */ | ||
129 | msg_t sio_lld_control(SIODriver *siop, unsigned int operation, void *arg) { | ||
130 | |||
131 | (void)siop; | ||
132 | (void)operation; | ||
133 | (void)arg; | ||
134 | |||
135 | return MSG_OK; | ||
136 | } | ||
137 | |||
138 | #endif /* HAL_USE_SIO == TRUE */ | ||
139 | |||
140 | /** @} */ | ||