ChibiOS/HAL  6.1.0
hal_i2s_lld.c
Go to the documentation of this file.
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_i2s_lld.c
19  * @brief PLATFORM I2S subsystem low level driver source.
20  *
21  * @addtogroup I2S
22  * @{
23  */
24 
25 #include "hal.h"
26 
27 #if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
28 
29 /*===========================================================================*/
30 /* Driver local definitions. */
31 /*===========================================================================*/
32 
33 /*===========================================================================*/
34 /* Driver exported variables. */
35 /*===========================================================================*/
36 
37 /** @brief I2S2 driver identifier.*/
38 #if (PLATFORM_I2S_USE_I2S1 == TRUE) || defined(__DOXYGEN__)
40 #endif
41 
42 /*===========================================================================*/
43 /* Driver local variables and types. */
44 /*===========================================================================*/
45 
46 /*===========================================================================*/
47 /* Driver local functions. */
48 /*===========================================================================*/
49 
50 /*===========================================================================*/
51 /* Driver interrupt handlers. */
52 /*===========================================================================*/
53 
54 /*===========================================================================*/
55 /* Driver exported functions. */
56 /*===========================================================================*/
57 
58 /**
59  * @brief Low level I2S driver initialization.
60  *
61  * @notapi
62  */
63 void i2s_lld_init(void) {
64 
65 #if PLATFORM_I2S_USE_I2S1
66  i2sObjectInit(&I2SD1);
67 #endif
68 }
69 
70 /**
71  * @brief Configures and activates the I2S peripheral.
72  *
73  * @param[in] i2sp pointer to the @p I2SDriver object
74  *
75  * @notapi
76  */
77 void i2s_lld_start(I2SDriver *i2sp) {
78 
79  /* If in stopped state then enables the SPI and DMA clocks.*/
80  if (i2sp->state == I2S_STOP) {
81 
82 #if PLATFORM_I2S_USE_I2S1
83  if (&I2SD1 == i2sp) {
84 
85  }
86 #endif
87  }
88 }
89 
90 /**
91  * @brief Deactivates the I2S peripheral.
92  *
93  * @param[in] i2sp pointer to the @p I2SDriver object
94  *
95  * @notapi
96  */
97 void i2s_lld_stop(I2SDriver *i2sp) {
98 
99  /* If in ready state then disables the SPI clock.*/
100  if (i2sp->state == I2S_READY) {
101 #if PLATFORM_I2S_USE_I2S1
102  if (&I2SD1 == i2sp) {
103 
104  }
105 #endif
106  }
107 }
108 
109 /**
110  * @brief Starts a I2S data exchange.
111  *
112  * @param[in] i2sp pointer to the @p I2SDriver object
113  *
114  * @notapi
115  */
117 
118  (void)i2sp;
119 }
120 
121 /**
122  * @brief Stops the ongoing data exchange.
123  * @details The ongoing data exchange, if any, is stopped, if the driver
124  * was not active the function does nothing.
125  *
126  * @param[in] i2sp pointer to the @p I2SDriver object
127  *
128  * @notapi
129  */
131 
132  (void)i2sp;
133 }
134 
135 #endif /* HAL_USE_I2S */
136 
137 /** @} */
I2SDriver I2SD1
I2S2 driver identifier.
Definition: hal_i2s_lld.c:39
void i2s_lld_init(void)
Low level I2S driver initialization.
Definition: hal_i2s_lld.c:63
void i2s_lld_stop(I2SDriver *i2sp)
Deactivates the I2S peripheral.
Definition: hal_i2s_lld.c:97
HAL subsystem header.
void i2sObjectInit(I2SDriver *i2sp)
Initializes the standard part of a I2SDriver structure.
Definition: hal_i2s.c:68
Structure representing an I2S driver.
Definition: hal_i2s_lld.h:103
i2sstate_t state
Driver state.
Definition: hal_i2s_lld.h:107
void i2s_lld_start_exchange(I2SDriver *i2sp)
Starts a I2S data exchange.
Definition: hal_i2s_lld.c:116
void i2s_lld_stop_exchange(I2SDriver *i2sp)
Stops the ongoing data exchange.
Definition: hal_i2s_lld.c:130
void i2s_lld_start(I2SDriver *i2sp)
Configures and activates the I2S peripheral.
Definition: hal_i2s_lld.c:77