File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -118,12 +118,17 @@ sai_result_t sai_init(sai_t *obj, sai_init_t *init) {
118
118
obj -> channel = 0U ; // we should get it from the sd pin
119
119
120
120
config .protocol = kSAI_BusI2S ;
121
-
122
121
if (init -> is_receiver ) {
123
122
config .masterSlave = kSAI_Slave ;
124
123
SAI_RxInit (obj -> base , & config );
124
+ // do this "manually" because SAI_RxSoftwareReset is not available on all targets.
125
+ obj -> base -> RCSR |= I2S_RCSR_SR_MASK | I2S_RCSR_FR_MASK ; // this will reset both chan 0 & 1.
126
+ obj -> base -> RCSR &= ~(I2S_RCSR_SR_MASK | I2S_RCSR_FR_MASK );
125
127
} else {
126
128
SAI_TxInit (obj -> base , & config );
129
+ // do this "manually" because SAI_TxSoftwareReset is not available on all targets.
130
+ obj -> base -> TCSR |= I2S_TCSR_SR_MASK | I2S_TCSR_FR_MASK ; // this will reset both chan 0 & 1.
131
+ obj -> base -> TCSR &= ~(I2S_TCSR_SR_MASK | I2S_TCSR_FR_MASK );
127
132
}
128
133
129
134
/* Configure the audio format */
@@ -203,6 +208,9 @@ void sai_free(sai_t *obj) {
203
208
SAI_TxEnable (obj -> base , false);
204
209
sai_transmitter_initialized = false;
205
210
}
206
- // Should it also unclock the periph ?
211
+
212
+ if (!sai_receiver_initialized && !sai_transmitter_initialized ) {
213
+ SAI_Deinit (obj -> base );
214
+ }
207
215
}
208
216
#endif
You can’t perform that action at this time.
0 commit comments