Changeset 3468
- Timestamp:
- Dec 3, 2012 8:07:43 AM (6 months ago)
- File:
-
- 1 edited
-
cpu/arm/olpc/gpio-i2c.fth (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/olpc/gpio-i2c.fth
r3456 r3468 43 43 0 0 encode-bytes 44 44 cam-sda-gpio# 0 encode-gpio 45 cam-scl-gpio# 0 encode-gpio45 cam-scl-gpio# 0 encode-gpio 46 46 " gpios" property 47 47 … … 145 145 h# 50 1 reg 146 146 : close ( -- ) ; 147 h# 100 buffer: hdmi-edid 148 149 : get-edid ( -- adr len ) 150 hdmi-edid h# 100 0 " i2c-read" $call-parent 151 hdmi-edid h# 100 147 h# 80 constant /edid-chunk 148 0 value edid 149 0 value /edid 150 151 : release-edid ( -- ) 152 edid /edid free-mem ( ) 153 0 to /edid 0 to edid ( ) 152 154 ; 155 153 156 : open ( -- okay? ) 154 157 my-unit " set-address" $call-parent 155 hdmi-edid h# 100 0 " i2c-read" ['] $call-parent catch if 156 2drop 3drop false 157 else 158 true 158 /edid-chunk to /edid 159 /edid alloc-mem to edid 160 161 edid /edid 0 " i2c-read" ['] $call-parent catch if ( x x x x x ) 162 2drop 3drop ( ) 163 release-edid false exit ( -- false ) 159 164 then 165 166 \ Basic sanity check to make sure it's an EDID 167 edid " "(00ffffffffffff00)" comp if ( ) 168 release-edid false exit ( -- false ) 169 then 170 171 \ We could (should) do a checksum here... 172 173 \ If there are no extensions, exit now, successfully 174 edid d# 126 + c@ dup 0= over h# ff = or if ( #exts ) 175 drop true exit ( -- true ) 176 then ( #exts ) 177 178 \ Otherwise make the buffer larger to accomodate the extensions ... 179 1+ /edid-chunk * to /edid ( ) 180 edid /edid resize-memory if ( adr' ) 181 drop ( ) 182 0 to /edid 0 to edid ( ) 183 false exit ( ) 184 then ( adr ) 185 to edid ( ) 186 187 \ ... and read the extensions 188 edid /edid /edid-chunk /string /edid-chunk ( adr len offset ) 189 " i2c-read" ['] $call-parent catch if ( x x x x x ) 190 2drop 3drop ( ) 191 release-edid false exit ( -- false ) 192 then 193 194 true 160 195 ; 161 : edid$ ( -- adr len ) hdmi-edid h# 100;196 : edid$ ( -- adr len ) edid /edid ; 162 197 finish-device 163 198 finish-device 164 199 [then] 165 200 device-end 201 202 devalias i2c6 /hdmi-i2c
Note: See TracChangeset
for help on using the changeset viewer.
