1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
#[doc = "Reader of register SR"] pub type R = crate::R<u32, super::SR>; #[doc = "Overrun / underrun. This bit is read only. The overrun and underrun conditions can occur only when the audio block is configured as a receiver and a transmitter, respectively. It can generate an interrupt if OVRUDRIE bit is set in SAI_xIM register. This flag is cleared when the software sets COVRUDR bit in SAI_xCLRFR register.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum OVRUDR_A { #[doc = "0: No overrun/underrun error"] NOERROR = 0, #[doc = "1: Overrun/underrun error detection"] OVERRUN = 1, } impl From<OVRUDR_A> for bool { #[inline(always)] fn from(variant: OVRUDR_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `OVRUDR`"] pub type OVRUDR_R = crate::R<bool, OVRUDR_A>; impl OVRUDR_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> OVRUDR_A { match self.bits { false => OVRUDR_A::NOERROR, true => OVRUDR_A::OVERRUN, } } #[doc = "Checks if the value of the field is `NOERROR`"] #[inline(always)] pub fn is_no_error(&self) -> bool { *self == OVRUDR_A::NOERROR } #[doc = "Checks if the value of the field is `OVERRUN`"] #[inline(always)] pub fn is_overrun(&self) -> bool { *self == OVRUDR_A::OVERRUN } } #[doc = "Mute detection. This bit is read only. This flag is set if consecutive 0 values are received in each slot of a given audio frame and for a consecutive number of audio frames (set in the MUTECNT bit in the SAI_xCR2 register). It can generate an interrupt if MUTEDETIE bit is set in SAI_xIM register. This flag is cleared when the software sets bit CMUTEDET in the SAI_xCLRFR register.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum MUTEDET_A { #[doc = "0: No MUTE detection on the SD input line"] NOMUTE = 0, #[doc = "1: MUTE value detected on the SD input line (0 value) for a specified number of consecutive audio frame"] MUTE = 1, } impl From<MUTEDET_A> for bool { #[inline(always)] fn from(variant: MUTEDET_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `MUTEDET`"] pub type MUTEDET_R = crate::R<bool, MUTEDET_A>; impl MUTEDET_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> MUTEDET_A { match self.bits { false => MUTEDET_A::NOMUTE, true => MUTEDET_A::MUTE, } } #[doc = "Checks if the value of the field is `NOMUTE`"] #[inline(always)] pub fn is_no_mute(&self) -> bool { *self == MUTEDET_A::NOMUTE } #[doc = "Checks if the value of the field is `MUTE`"] #[inline(always)] pub fn is_mute(&self) -> bool { *self == MUTEDET_A::MUTE } } #[doc = "Wrong clock configuration flag. This bit is read only. This bit is used only when the audio block operates in master mode (MODE\\[1\\] = 0) and NODIV = 0. It can generate an interrupt if WCKCFGIE bit is set in SAI_xIM register. This flag is cleared when the software sets CWCKCFG bit in SAI_xCLRFR register.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum WCKCFG_A { #[doc = "0: Clock configuration is correct"] CORRECT = 0, #[doc = "1: Clock configuration does not respect the rule concerning the frame length specification"] WRONG = 1, } impl From<WCKCFG_A> for bool { #[inline(always)] fn from(variant: WCKCFG_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `WCKCFG`"] pub type WCKCFG_R = crate::R<bool, WCKCFG_A>; impl WCKCFG_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> WCKCFG_A { match self.bits { false => WCKCFG_A::CORRECT, true => WCKCFG_A::WRONG, } } #[doc = "Checks if the value of the field is `CORRECT`"] #[inline(always)] pub fn is_correct(&self) -> bool { *self == WCKCFG_A::CORRECT } #[doc = "Checks if the value of the field is `WRONG`"] #[inline(always)] pub fn is_wrong(&self) -> bool { *self == WCKCFG_A::WRONG } } #[doc = "FIFO request. This bit is read only. The request depends on the audio block configuration: If the block is configured in transmission mode, the FIFO request is related to a write request operation in the SAI_xDR. If the block configured in reception, the FIFO request related to a read request operation from the SAI_xDR. This flag can generate an interrupt if FREQIE bit is set in SAI_xIM register.\n\nValue on reset: 1"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum FREQ_A { #[doc = "0: No FIFO request"] NOREQUEST = 0, #[doc = "1: FIFO request to read or to write the SAI_xDR"] REQUEST = 1, } impl From<FREQ_A> for bool { #[inline(always)] fn from(variant: FREQ_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `FREQ`"] pub type FREQ_R = crate::R<bool, FREQ_A>; impl FREQ_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> FREQ_A { match self.bits { false => FREQ_A::NOREQUEST, true => FREQ_A::REQUEST, } } #[doc = "Checks if the value of the field is `NOREQUEST`"] #[inline(always)] pub fn is_no_request(&self) -> bool { *self == FREQ_A::NOREQUEST } #[doc = "Checks if the value of the field is `REQUEST`"] #[inline(always)] pub fn is_request(&self) -> bool { *self == FREQ_A::REQUEST } } #[doc = "Codec not ready. This bit is read only. This bit is used only when the AC97 audio protocol is selected in the SAI_xCR1 register and configured in receiver mode. It can generate an interrupt if CNRDYIE bit is set in SAI_xIM register. This flag is cleared when the software sets CCNRDY bit in SAI_xCLRFR register.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CNRDY_A { #[doc = "0: External AC\u{2019}97 Codec is ready"] READY = 0, #[doc = "1: External AC\u{2019}97 Codec is not ready"] NOTREADY = 1, } impl From<CNRDY_A> for bool { #[inline(always)] fn from(variant: CNRDY_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `CNRDY`"] pub type CNRDY_R = crate::R<bool, CNRDY_A>; impl CNRDY_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CNRDY_A { match self.bits { false => CNRDY_A::READY, true => CNRDY_A::NOTREADY, } } #[doc = "Checks if the value of the field is `READY`"] #[inline(always)] pub fn is_ready(&self) -> bool { *self == CNRDY_A::READY } #[doc = "Checks if the value of the field is `NOTREADY`"] #[inline(always)] pub fn is_not_ready(&self) -> bool { *self == CNRDY_A::NOTREADY } } #[doc = "Anticipated frame synchronization detection. This bit is read only. This flag can be set only if the audio block is configured in slave mode. It is not used in AC97or SPDIF mode. It can generate an interrupt if AFSDETIE bit is set in SAI_xIM register. This flag is cleared when the software sets CAFSDET bit in SAI_xCLRFR register.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum AFSDET_A { #[doc = "0: No error"] NOERROR = 0, #[doc = "1: Frame synchronization signal is detected earlier than expected"] EARLYSYNC = 1, } impl From<AFSDET_A> for bool { #[inline(always)] fn from(variant: AFSDET_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `AFSDET`"] pub type AFSDET_R = crate::R<bool, AFSDET_A>; impl AFSDET_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> AFSDET_A { match self.bits { false => AFSDET_A::NOERROR, true => AFSDET_A::EARLYSYNC, } } #[doc = "Checks if the value of the field is `NOERROR`"] #[inline(always)] pub fn is_no_error(&self) -> bool { *self == AFSDET_A::NOERROR } #[doc = "Checks if the value of the field is `EARLYSYNC`"] #[inline(always)] pub fn is_early_sync(&self) -> bool { *self == AFSDET_A::EARLYSYNC } } #[doc = "Late frame synchronization detection. This bit is read only. This flag can be set only if the audio block is configured in slave mode. It is not used in AC97 or SPDIF mode. It can generate an interrupt if LFSDETIE bit is set in the SAI_xIM register. This flag is cleared when the software sets bit CLFSDET in SAI_xCLRFR register\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum LFSDET_A { #[doc = "0: No error"] NOERROR = 0, #[doc = "1: Frame synchronization signal is not present at the right time"] NOSYNC = 1, } impl From<LFSDET_A> for bool { #[inline(always)] fn from(variant: LFSDET_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `LFSDET`"] pub type LFSDET_R = crate::R<bool, LFSDET_A>; impl LFSDET_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> LFSDET_A { match self.bits { false => LFSDET_A::NOERROR, true => LFSDET_A::NOSYNC, } } #[doc = "Checks if the value of the field is `NOERROR`"] #[inline(always)] pub fn is_no_error(&self) -> bool { *self == LFSDET_A::NOERROR } #[doc = "Checks if the value of the field is `NOSYNC`"] #[inline(always)] pub fn is_no_sync(&self) -> bool { *self == LFSDET_A::NOSYNC } } #[doc = "FIFO level threshold. This bit is read only. The FIFO level threshold flag is managed only by hardware and its setting depends on SAI block configuration (transmitter or receiver mode). If the SAI block is configured as transmitter: If SAI block is configured as receiver:\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum FLVL_A { #[doc = "0: FIFO empty"] EMPTY = 0, #[doc = "1: FIFO <= 1\u{2044}4 but not empty"] QUARTER1 = 1, #[doc = "2: 1\u{2044}4 < FIFO <= 1\u{2044}2"] QUARTER2 = 2, #[doc = "3: 1\u{2044}2 < FIFO <= 3\u{2044}4"] QUARTER3 = 3, #[doc = "4: 3\u{2044}4 < FIFO but not full"] QUARTER4 = 4, #[doc = "5: FIFO full"] FULL = 5, } impl From<FLVL_A> for u8 { #[inline(always)] fn from(variant: FLVL_A) -> Self { variant as _ } } #[doc = "Reader of field `FLVL`"] pub type FLVL_R = crate::R<u8, FLVL_A>; impl FLVL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, FLVL_A> { use crate::Variant::*; match self.bits { 0 => Val(FLVL_A::EMPTY), 1 => Val(FLVL_A::QUARTER1), 2 => Val(FLVL_A::QUARTER2), 3 => Val(FLVL_A::QUARTER3), 4 => Val(FLVL_A::QUARTER4), 5 => Val(FLVL_A::FULL), i => Res(i), } } #[doc = "Checks if the value of the field is `EMPTY`"] #[inline(always)] pub fn is_empty(&self) -> bool { *self == FLVL_A::EMPTY } #[doc = "Checks if the value of the field is `QUARTER1`"] #[inline(always)] pub fn is_quarter1(&self) -> bool { *self == FLVL_A::QUARTER1 } #[doc = "Checks if the value of the field is `QUARTER2`"] #[inline(always)] pub fn is_quarter2(&self) -> bool { *self == FLVL_A::QUARTER2 } #[doc = "Checks if the value of the field is `QUARTER3`"] #[inline(always)] pub fn is_quarter3(&self) -> bool { *self == FLVL_A::QUARTER3 } #[doc = "Checks if the value of the field is `QUARTER4`"] #[inline(always)] pub fn is_quarter4(&self) -> bool { *self == FLVL_A::QUARTER4 } #[doc = "Checks if the value of the field is `FULL`"] #[inline(always)] pub fn is_full(&self) -> bool { *self == FLVL_A::FULL } } impl R { #[doc = "Bit 0 - Overrun / underrun. This bit is read only. The overrun and underrun conditions can occur only when the audio block is configured as a receiver and a transmitter, respectively. It can generate an interrupt if OVRUDRIE bit is set in SAI_xIM register. This flag is cleared when the software sets COVRUDR bit in SAI_xCLRFR register."] #[inline(always)] pub fn ovrudr(&self) -> OVRUDR_R { OVRUDR_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Mute detection. This bit is read only. This flag is set if consecutive 0 values are received in each slot of a given audio frame and for a consecutive number of audio frames (set in the MUTECNT bit in the SAI_xCR2 register). It can generate an interrupt if MUTEDETIE bit is set in SAI_xIM register. This flag is cleared when the software sets bit CMUTEDET in the SAI_xCLRFR register."] #[inline(always)] pub fn mutedet(&self) -> MUTEDET_R { MUTEDET_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Wrong clock configuration flag. This bit is read only. This bit is used only when the audio block operates in master mode (MODE\\[1\\] = 0) and NODIV = 0. It can generate an interrupt if WCKCFGIE bit is set in SAI_xIM register. This flag is cleared when the software sets CWCKCFG bit in SAI_xCLRFR register."] #[inline(always)] pub fn wckcfg(&self) -> WCKCFG_R { WCKCFG_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - FIFO request. This bit is read only. The request depends on the audio block configuration: If the block is configured in transmission mode, the FIFO request is related to a write request operation in the SAI_xDR. If the block configured in reception, the FIFO request related to a read request operation from the SAI_xDR. This flag can generate an interrupt if FREQIE bit is set in SAI_xIM register."] #[inline(always)] pub fn freq(&self) -> FREQ_R { FREQ_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Codec not ready. This bit is read only. This bit is used only when the AC97 audio protocol is selected in the SAI_xCR1 register and configured in receiver mode. It can generate an interrupt if CNRDYIE bit is set in SAI_xIM register. This flag is cleared when the software sets CCNRDY bit in SAI_xCLRFR register."] #[inline(always)] pub fn cnrdy(&self) -> CNRDY_R { CNRDY_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - Anticipated frame synchronization detection. This bit is read only. This flag can be set only if the audio block is configured in slave mode. It is not used in AC97or SPDIF mode. It can generate an interrupt if AFSDETIE bit is set in SAI_xIM register. This flag is cleared when the software sets CAFSDET bit in SAI_xCLRFR register."] #[inline(always)] pub fn afsdet(&self) -> AFSDET_R { AFSDET_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - Late frame synchronization detection. This bit is read only. This flag can be set only if the audio block is configured in slave mode. It is not used in AC97 or SPDIF mode. It can generate an interrupt if LFSDETIE bit is set in the SAI_xIM register. This flag is cleared when the software sets bit CLFSDET in SAI_xCLRFR register"] #[inline(always)] pub fn lfsdet(&self) -> LFSDET_R { LFSDET_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bits 16:18 - FIFO level threshold. This bit is read only. The FIFO level threshold flag is managed only by hardware and its setting depends on SAI block configuration (transmitter or receiver mode). If the SAI block is configured as transmitter: If SAI block is configured as receiver:"] #[inline(always)] pub fn flvl(&self) -> FLVL_R { FLVL_R::new(((self.bits >> 16) & 0x07) as u8) } }