Changeset 3456
- Timestamp:
- Nov 24, 2012 1:33:25 AM (6 months ago)
- File:
-
- 1 edited
-
cpu/arm/olpc/gpio-i2c.fth (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/olpc/gpio-i2c.fth
r3393 r3456 111 111 : close ( -- ) ; 112 112 finish-device 113 114 [ifdef] hdmi-sda-gpio# 115 new-device 116 " hdmi-i2c" device-name 117 " i2c-gpio" +compatible 118 1 " #address-cells" integer-property 119 1 " #size-cells" integer-property 120 : encode-unit ( phys.. -- str ) push-hex (u.) pop-base ; 121 : decode-unit ( str -- phys.. ) push-hex $number if 0 then pop-base ; 122 123 0 0 encode-bytes 124 hdmi-sda-gpio# 0 encode-gpio 125 hdmi-scl-gpio# 0 encode-gpio 126 " gpios" property 127 128 h# 50 instance value slave-address 129 : set-address ( slave -- ) to slave-address ; 130 : smb-setup 131 1 to smb-dly-us hdmi-scl-gpio# to smb-clock-gpio# 132 hdmi-sda-gpio# to smb-data-gpio# 133 slave-address to smb-slave 134 ; 135 \ Since this I2C bus is dedicated to HDMI, we save space by 136 \ implementing only the methods that HDMI DDC uses 137 : reg-b@ ( reg# -- b ) smb-setup smb-byte@ ; 138 : reg-b! ( b reg# -- ) smb-setup smb-byte! ; 139 : i2c-read ( adr len reg# -- ) smb-setup smb-read ; 140 : open ( -- flag ) true ; 141 : close ( -- ) ; 142 143 new-device 144 " hdmi-ddc" device-name 145 h# 50 1 reg 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 152 ; 153 : open ( -- okay? ) 154 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 159 then 160 ; 161 : edid$ ( -- adr len ) hdmi-edid h# 100 ; 162 finish-device 163 finish-device 164 [then] 113 165 device-end
Note: See TracChangeset
for help on using the changeset viewer.
