Changeset 2990
- Timestamp:
- May 31, 2012 7:28:43 AM (12 months ago)
- File:
-
- 1 edited
-
dev/mmc/sdhci/sdhci.fth (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dev/mmc/sdhci/sdhci.fth
r2192 r2990 89 89 \ : led-off ( -- ) h# 28 cb@ 1 invert and h# 28 cb! ; 90 90 91 \ We leave the remove and insert interrupt enables on because the 92 \ hardware has a bug that blocks the card detection status bits 93 \ unless the interrupt enables are on. 94 0 instance value intstat-count 95 : intstat-on ( -- ) 96 intstat-count 0= if 97 h# 00cb h# 34 cw! \ normal interrupt status en reg 98 \ Enable: Remove, Insert, DMA Interrupt, Transfer Complete, CMD Complete 99 \ Disable: Card Interrupt, Read Ready, Write Ready, Block Gap 100 h# f1ff h# 36 cw! \ error interrupt status en reg 101 then 102 intstat-count 1+ to intstat-count 103 ; 104 : intstat-off ( -- ) 105 intstat-count 1- 0 max to intstat-count 106 intstat-count 0= if 107 h# c0 h# 34 cl! \ Remove, Insert on, others off 108 then 109 ; 110 91 111 \ There is no need to use the debounced version (the 3.0000 bits). 92 112 \ We poll for the card when the SDMMC driver opens, rather than … … 96 116 defer card-inserted? 97 117 : sdhci-card-inserted? ( -- flag ) 118 intstat-on 98 119 get-msecs d# 500 + begin ( time-limit ) 99 120 \ When the stable bit is set, we can believe the answer … … 101 122 drop ( ) 102 123 present-state@ h# 10000 and 0<> ( flag ) 124 intstat-off ( flag ) 103 125 exit ( -- flag ) 104 126 then ( time-limit ) … … 108 130 ." SD Card detect unstable!" cr ( ) 109 131 false ( flag ) 132 intstat-off ( flag ) 110 133 ; 111 134 ' sdhci-card-inserted? to card-inserted? … … 170 193 171 194 : data-timeout! ( n -- ) h# 2e cb! ; 172 173 \ We leave the remove and insert interrupt enables on because the174 \ hardware has a bug that blocks the card detection status bits175 \ unless the interrupt enables are on.176 : intstat-on ( -- )177 h# 00cb h# 34 cw! \ normal interrupt status en reg178 \ Enable: Remove, Insert, DMA Interrupt, Transfer Complete, CMD Complete179 \ Disable: Card Interrupt, Read Ready, Write Ready, Block Gap180 h# f1ff h# 36 cw! \ error interrupt status en reg181 ;182 : intstat-off ( -- ) h# c0 h# 34 cl! ; \ Remove, Insert on, others off183 195 184 196 : setup-host ( -- )
Note: See TracChangeset
for help on using the changeset viewer.
