Changeset 3257


Ignore:
Timestamp:
Aug 30, 2012, 11:28:30 PM (3 years ago)
Author:
wmb
Message:

OLPC ARM - Converted the nn-touchscreen driver to use the new TWSI factoring. It now has no references to "twsi" - so it doesn't care what kind of I2C hardware implements its system interface. There is now only one "touchscreen" device node.

Location:
cpu/arm/olpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/nn-touchscreen.fth

    r3250 r3257  
    22purpose: Driver and diagnostic for Neonode zForce MultiSensing I2C Touchscreen
    33
    4 0 0  " 4,50"  " /twsi" begin-package
    5 my-space encode-int  my-address encode-int encode+  " reg" property
     4dev /i2c@d4033000
     5new-device
     6
     7h# 50 1 reg
     8
     9" zforce" +compatible
     10touch-rst-gpio# 1  " reset-gpios" gpio-property
     11touch-tck-gpio# 1  " test-gpios"  gpio-property
     12touch-hd-gpio#  1  " hd-gpios"    gpio-property
     13touch-int-gpio# 1  " dr-gpios"    gpio-property
     14
     15: read-bytes  ( adr len -- )  " read-bytes"  $call-parent  ;
     16: bytes-out  ( byte .. #bytes -- )  " bytes-out"  $call-parent  ;
    617
    718create nn-os            \ open short test
     
    5162   no-data?  if  false exit  then
    5263
    53    pbuf 2  twsi-read                            ( )
     64   pbuf 2  read-bytes                           ( )
    5465   pbuf 1+ c@                                   ( len )
    5566   dup 2+ to plen                               ( len )
    5667
    57    pbuf 2+ swap  twsi-read                      ( )
     68   pbuf 2+ swap  read-bytes                     ( )
    5869
    5970   pbuf 2+ c@ h# 07 =  pbuf 3 + c@ 0=  and  if  ( )
     
    8192: read-boot-complete  ( -- )  h# 07 d# 0 anticipate  ;
    8293
    83 : initialise  ( -- )  h# 01 h# 01 h# ee  3 twsi-out  h# 01 d# 20 anticipate  ;
     94: initialise  ( -- )  h# 01 h# 01 h# ee  3 bytes-out  h# 01 d# 20 anticipate  ;
    8495
    8596: set-resolution  ( -- )
    8697   set-geometry
    87    screen-h wbsplit swap  screen-w wbsplit swap  h# 02 h# 05 h# ee  7 twsi-out
     98   screen-h wbsplit swap  screen-w wbsplit swap  h# 02 h# 05 h# ee  7 bytes-out
    8899   h# 02 d# 20 anticipate
    89100;
    90101
    91 : start  ( -- )  h# 04 h# 01 h# ee  3 twsi-out  ;
     102: start  ( -- )  h# 04 h# 01 h# ee  3 bytes-out  ;
    92103
    93104: deactivate  ( -- )
    94    h# 00 h# 01 h# ee  3 twsi-out  h# 00 d# 20 anticipate
     105   h# 00 h# 01 h# ee  3 bytes-out  h# 00 d# 20 anticipate
    95106   true to configure?
    96107;
     
    107118: open  ( -- okay? )
    108119   pbuf-alloc
    109    my-unit set-twsi-target
     120   my-unit " set-address" $call-parent
    110121   set-gpios
    111122   no-data?  if
     
    175186
    176187: test-version  ( -- )
    177    h# 1e h# 01 h# ee  3 twsi-out
     188   h# 1e h# 01 h# ee  3 bytes-out
    178189   h# 1e d# 30 anticipate
    179190
     
    335346
    336347: test-os-axis  ( axis -- )
    337    h# 21 h# 02 h# ee  4 twsi-out
     348   h# 21 h# 02 h# ee  4 bytes-out
    338349   h# 21 d# 30 anticipate
    339350   pbuf 2+ c@ h# 21 <> abort" bad response"
     
    395406
    396407: test-fss-axis  ( axis -- )
    397    d# 64 swap h# 0f h# 03 h# ee  5 twsi-out
     408   d# 64 swap h# 0f h# 03 h# ee  5 bytes-out
    398409   h# 0f d# 20 anticipate
    399410   pbuf 2+ c@ h# 0f <> abort" bad response"
     
    425436[ifdef] nn-ls \ low signals test
    426437: test-ls-axis  ( axis -- )
    427    h# 0d h# 02 h# ee  4 twsi-out
     438   h# 0d h# 02 h# ee  4 bytes-out
    428439   h# 0d d# 200 anticipate
    429440   pbuf 2+ c@ h# 0d <> abort" bad response"
     
    482493
    483494: test-fll-axis  ( axis -- )
    484    h# 20 h# 02 h# ee  4 twsi-out
     495   h# 20 h# 02 h# ee  4 bytes-out
    485496   h# 1c d# 200 anticipate
    486497   pbuf plen cdump cr
     
    591602;
    592603
    593 end-package
     604finish-device
     605device-end
    594606
    595607\ LICENSE_BEGIN
  • cpu/arm/olpc/twsi-i2c.fth

    r3256 r3257  
    1212
    1313[ifdef] soon-olpc-cl2  \ this breaks cl4-a1 boards, which ofw calls cl2.
    14 0 0  " 30" " /i2c@d4033000" begin-package  \ TWSI4
     14dev /i2c@d4033000  \ TWSI4
     15new-device
     16   h# 30 1 reg
    1517   " touchscreen" name
    1618   " raydium_ts" +compatible
    17    my-address my-space 1 reg
    18 end-package
    19 [else]
    20 dev /i2c@d4033000  \ TWSI4
    21 new-device
    22    h# 50 1 reg
    23    " touchscreen" name
    24    " zforce" +compatible
    25    my-address my-space 1 reg
    26    touch-rst-gpio# 1  " reset-gpios" gpio-property
    27    touch-tck-gpio# 1  " test-gpios"  gpio-property
    28    touch-hd-gpio#  1  " hd-gpios"    gpio-property
    29    touch-int-gpio# 1  " dr-gpios"    gpio-property
    3019finish-device
    3120device-end
Note: See TracChangeset for help on using the changeset viewer.