esp32/sdhost/
tmout.rs

1#[doc = "Register `TMOUT` reader"]
2pub type R = crate::R<TMOUT_SPEC>;
3#[doc = "Register `TMOUT` writer"]
4pub type W = crate::W<TMOUT_SPEC>;
5#[doc = "Field `RESPONSE_TIMEOUT` reader - Response timeout value. Value is specified in terms of number of card output clocks, i.e., sdhost_cclk_out."]
6pub type RESPONSE_TIMEOUT_R = crate::FieldReader;
7#[doc = "Field `RESPONSE_TIMEOUT` writer - Response timeout value. Value is specified in terms of number of card output clocks, i.e., sdhost_cclk_out."]
8pub type RESPONSE_TIMEOUT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `DATA_TIMEOUT` reader - Value for card data read timeout. This value is also used for data starvation by host timeout. The timeout counter is started only after the card clock is stopped. This value is specified in number of card output clocks, i.e. sdhost_cclk_out of the selected card. NOTE: The software timer should be used if the timeout value is in the order of 100 ms. In this case, read data timeout interrupt needs to be disabled."]
10pub type DATA_TIMEOUT_R = crate::FieldReader<u32>;
11#[doc = "Field `DATA_TIMEOUT` writer - Value for card data read timeout. This value is also used for data starvation by host timeout. The timeout counter is started only after the card clock is stopped. This value is specified in number of card output clocks, i.e. sdhost_cclk_out of the selected card. NOTE: The software timer should be used if the timeout value is in the order of 100 ms. In this case, read data timeout interrupt needs to be disabled."]
12pub type DATA_TIMEOUT_W<'a, REG> = crate::FieldWriter<'a, REG, 24, u32>;
13impl R {
14    #[doc = "Bits 0:7 - Response timeout value. Value is specified in terms of number of card output clocks, i.e., sdhost_cclk_out."]
15    #[inline(always)]
16    pub fn response_timeout(&self) -> RESPONSE_TIMEOUT_R {
17        RESPONSE_TIMEOUT_R::new((self.bits & 0xff) as u8)
18    }
19    #[doc = "Bits 8:31 - Value for card data read timeout. This value is also used for data starvation by host timeout. The timeout counter is started only after the card clock is stopped. This value is specified in number of card output clocks, i.e. sdhost_cclk_out of the selected card. NOTE: The software timer should be used if the timeout value is in the order of 100 ms. In this case, read data timeout interrupt needs to be disabled."]
20    #[inline(always)]
21    pub fn data_timeout(&self) -> DATA_TIMEOUT_R {
22        DATA_TIMEOUT_R::new((self.bits >> 8) & 0x00ff_ffff)
23    }
24}
25#[cfg(feature = "impl-register-debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("TMOUT")
29            .field("response_timeout", &self.response_timeout())
30            .field("data_timeout", &self.data_timeout())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:7 - Response timeout value. Value is specified in terms of number of card output clocks, i.e., sdhost_cclk_out."]
36    #[inline(always)]
37    pub fn response_timeout(&mut self) -> RESPONSE_TIMEOUT_W<TMOUT_SPEC> {
38        RESPONSE_TIMEOUT_W::new(self, 0)
39    }
40    #[doc = "Bits 8:31 - Value for card data read timeout. This value is also used for data starvation by host timeout. The timeout counter is started only after the card clock is stopped. This value is specified in number of card output clocks, i.e. sdhost_cclk_out of the selected card. NOTE: The software timer should be used if the timeout value is in the order of 100 ms. In this case, read data timeout interrupt needs to be disabled."]
41    #[inline(always)]
42    pub fn data_timeout(&mut self) -> DATA_TIMEOUT_W<TMOUT_SPEC> {
43        DATA_TIMEOUT_W::new(self, 8)
44    }
45}
46#[doc = "Data and response timeout configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`tmout::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tmout::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct TMOUT_SPEC;
48impl crate::RegisterSpec for TMOUT_SPEC {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`tmout::R`](R) reader structure"]
52impl crate::Readable for TMOUT_SPEC {}
53#[doc = "`write(|w| ..)` method takes [`tmout::W`](W) writer structure"]
54impl crate::Writable for TMOUT_SPEC {
55    type Safety = crate::Unsafe;
56    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
57    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
58}
59#[doc = "`reset()` method sets TMOUT to value 0xffff_ff40"]
60impl crate::Resettable for TMOUT_SPEC {
61    const RESET_VALUE: u32 = 0xffff_ff40;
62}