Author: wmb Date: Sat Jul 3 20:09:47 2010 New Revision: 1860 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1860
Log: OLPC - NANDblaster improvements - use new thin firmware on XO-1.5 so it can be a transmitter and cleaned up the split between the code for XO-1 and XO-1.5
Modified: cpu/x86/pc/olpc/fw.bth cpu/x86/pc/olpc/nandcastui.fth cpu/x86/pc/olpc/versions.fth cpu/x86/pc/olpc/via/fw.bth cpu/x86/pc/olpc/via/mcnand-version.fth cpu/x86/pc/olpc/via/nbrx.fth cpu/x86/pc/olpc/via/wlan-version.fth cpu/x86/pc/olpc/wifichannel.fth dev/libertas.fth ofw/wifi/wifi-cfg.fth
Modified: cpu/x86/pc/olpc/fw.bth ============================================================================== --- cpu/x86/pc/olpc/fw.bth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/fw.bth Sat Jul 3 20:09:47 2010 (r1860) @@ -463,6 +463,7 @@ ; ' olpc-ssids to default-ssids
+create use-mesh fload ${BP}/cpu/x86/bootascall.fth fload ${BP}/cpu/x86/pc/olpc/nandcastui.fth fload ${BP}/cpu/x86/pc/olpc/wifichannel.fth
Modified: cpu/x86/pc/olpc/nandcastui.fth ============================================================================== --- cpu/x86/pc/olpc/nandcastui.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/nandcastui.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -5,13 +5,14 @@ " olpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh" ;
-: use-mesh ( -- ) +: select-mesh-mode ( -- ) \ Check for already set because re-setting it will force rescanning ['] mesh-ssids to default-ssids wifi-cfg >wc-ssid pstr@ " olpc-mesh" $= 0= if " olpc-mesh" $essid then ; + : $file-to-mem ( filename$ -- adr len ) $read-open ifd @ fsize dup alloc-mem swap ( adr len ) @@ -74,7 +75,7 @@ : nb-secure11 ( -- ) d# 11 #nb-secure-def ;
: mesh-clone - use-mesh + select-mesh-mode false to already-go? redundancy " boot rom:nb_tx udp:239.255.1.2 nand: %d" sprintf eval ;
Modified: cpu/x86/pc/olpc/versions.fth ============================================================================== --- cpu/x86/pc/olpc/versions.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/versions.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -26,6 +26,6 @@ \ With a specific ID, mcastnand.bth will download a tarball without .git stuff. \ With "test", mcastnand.bth will clone the git head if build/multicast-nand/ \ is not already present, then you can modify the git subtree as needed. -macro: MCNAND_VERSION d1b388bcdf01f98a7b94bb62d0d3f1403fd27d1a +macro: MCNAND_VERSION af0cadd1cbfb17ddfa7dcf299c4c3662ad7120a4 \ macro: MCNAND_VERSION test \ macro: MCNAND_VERSION HEAD
Modified: cpu/x86/pc/olpc/via/fw.bth ============================================================================== --- cpu/x86/pc/olpc/via/fw.bth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/via/fw.bth Sat Jul 3 20:09:47 2010 (r1860) @@ -514,8 +514,10 @@ ; ' olpc-ssids to default-ssids
+create use-thinmac fload ${BP}/cpu/x86/bootascall.fth -fload ${BP}/cpu/x86/pc/olpc/nandcastui.fth +fload ${BP}/cpu/x86/pc/olpc/wifichannel.fth +fload ${BP}/cpu/x86/pc/olpc/nb15tx.fth fload ${BP}/cpu/x86/pc/olpc/via/nbrx.fth fload ${BP}/cpu/x86/pc/olpc/via/blockfifo.fth fload ${BP}/cpu/x86/pc/olpc/via/fsupdate.fth
Modified: cpu/x86/pc/olpc/via/mcnand-version.fth ============================================================================== --- cpu/x86/pc/olpc/via/mcnand-version.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/via/mcnand-version.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -3,6 +3,6 @@ \ With a specific ID, mcastnand.bth will download a tarball without .git stuff. \ With "test", mcastnand.bth will clone the git head if build/multicast-nand/ \ is not already present, then you can modify the git subtree as needed. -macro: MCNAND_VERSION d1b388bcdf01f98a7b94bb62d0d3f1403fd27d1a +macro: MCNAND_VERSION af0cadd1cbfb17ddfa7dcf299c4c3662ad7120a4 \ macro: MCNAND_VERSION test \ macro: MCNAND_VERSION HEAD
Modified: cpu/x86/pc/olpc/via/nbrx.fth ============================================================================== --- cpu/x86/pc/olpc/via/nbrx.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/via/nbrx.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -14,7 +14,6 @@ ; alias nb nandblaster
- \ This is the wired version that is used in the factory with big Ethernet switches. : $nb-rx ( multicast-ip$ -- ) false to already-go? @@ -22,9 +21,7 @@ ( multicast-ip$ ) " boot rom:nb15_rx mcast:%s" sprintf eval )boot-as-call ; -: nb-rx: ( "multicast-ip" -- ) - safe-parse-word $nb-rx -; +: nb-rx: ( "multicast-ip" -- ) safe-parse-word $nb-rx ; : nb-rx ( -- ) " 224.0.0.100" $nb-rx ;
[ifdef] adhoc-NANDblaster @@ -54,6 +51,7 @@ : mcopen " net:force" open-dev to nb-ih nb-ih 0= abort" Can't open net" + ['] null$ to default-ssids " OLPC-NANDblaster" $essid " do-associate" nb-ih $call-method drop " "(01 00 5e 7f 01 02)" " set-multicast" nb-ih $call-method
Modified: cpu/x86/pc/olpc/via/wlan-version.fth ============================================================================== --- cpu/x86/pc/olpc/via/wlan-version.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/via/wlan-version.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -1,7 +1,7 @@ \ The wireless LAN module firmware -macro: WLAN_VERSION 9.70.7.p0 +\ macro: WLAN_VERSION 9.70.7.p0
\ Alternate command for getting WLAN firmware, for testing new versions. \ Temporarily uncomment the line and modify the path as necessary \ macro: GET_WLAN cp "/c/Documents and Settings/Mitch Bradley/My Documents/OLPC/DiskImages/sd8686-9.70.7.p0.bin" sd8686.bin; cp "/c/Documents and Settings/Mitch Bradley/My Documents/OLPC/DiskImages/sd8686_helper.bin" sd8686_helper.bin -\ macro: GET_WLAN wget http://dev.laptop.org/pub/firmware/libertas/thinfirm/lbtf_sdio-9.0.7.p1.bin -O sd8686.bin +macro: GET_WLAN wget http://dev.laptop.org/pub/firmware/libertas/thinfirm/lbtf_sdio-9.0.7.p2.bin -O sd8686.bin
Modified: cpu/x86/pc/olpc/wifichannel.fth ============================================================================== --- cpu/x86/pc/olpc/wifichannel.fth Fri Jul 2 04:58:02 2010 (r1859) +++ cpu/x86/pc/olpc/wifichannel.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -5,11 +5,6 @@ d# 2048 buffer: scan-buf
: $call-wlan ( args method$ -- res ) wlan-ih $call-method ; -: stop-mesh ( -- ) " mesh-stop" $call-wlan drop ; -: start-mesh ( channel# -- ) - " mesh-start" $call-wlan drop - d# 100 0 " set-beacon" $call-wlan -;
: open-wlan ( -- ) " /wlan:force" open-dev to wlan-ih @@ -143,6 +138,14 @@ then ( chan# ) ;
+d# 1514 buffer: tx-test-buf + +[ifdef] use-mesh +: stop-mesh ( -- ) " mesh-stop" $call-wlan drop ; +: start-mesh ( channel# -- ) + " mesh-start" $call-wlan drop + d# 100 0 " set-beacon" $call-wlan +; : multinand-traffic? ( channel# -- flag ) start-mesh " "(01 00 5e 7e 01 02)" " set-multicast" $call-wlan @@ -176,24 +179,42 @@ search-channels close-wlan ; - -d# 1514 buffer: mesh-test-buf - -: (channel-speed) ( channel# -- kb/sec ) - dup >r start-mesh +: start-direct-wlan ( channel# -- ) + start-mesh " enable-multicast" $call-wlan 1 " mesh-set-ttl" $call-wlan h# b " mesh-set-bcast" $call-wlan
- " "(00 00 00 00 00 00 01 00 5e 7e 01 01)XO" mesh-test-buf swap move + " "(00 00 00 00 00 00 01 00 5e 7e 01 01)XO" tx-test-buf swap move +; +: stop-direct-wlan ( -- ) stop-mesh ; +\ : send-direct-wlan ( adr len -- ) " write" $call-wlan ; +[then] + +[ifdef] use-thinmac +: start-direct-wlan ( channel# -- ) + ( channel# ) + " OLPC-NANDblaster" " start-ap" $call-wlan ( ) + h# 1b " set-tx-ctrl" $call-wlan ( ) \ Fast data rate + " "(01)OLPC"(02)" tx-test-buf swap move ( ) + " get-mac-address" $call-wlan tx-test-buf 6 + swap move ( ) + " XO" tx-test-buf d# 12 + swap move ( ) +; +: stop-direct-wlan ( -- ) + " set-sta-mode" $call-wlan +; +\ : send-direct-wlan ( adr len -- ) " thin-send-data-frame" $call-wlan ; +[then]
+: (channel-speed) ( channel# -- kb/sec ) + dup >r start-direct-wlan tsc@ d# 1000 0 do - mesh-test-buf d# 1514 " write" $call-wlan drop + tx-test-buf d# 1514 " write" $call-wlan drop loop tsc@ 2swap d- ms-factor um/mod nip ( ms ) d# 1,514,000 swap / ( kb/sec ) - stop-mesh ( kb/sec ) + stop-direct-wlan ( kb/sec ) dup r> >channel-speed ! ( kb/sec ) ; : channel-speed ( channel# -- kb/sec ) @@ -293,9 +314,11 @@ d# 4000 ms ;
+[ifdef] use-mesh : nb-clone ( -- ) nb-auto-channel #nb-clone ; : nb-secure ( -- ) nb-auto-channel #nb-secure-def ; : nb-update ( -- ) nb-auto-channel #nb-update-def ; +[then]
\ LICENSE_BEGIN \ Copyright (c) 2008 FirmWorks
Modified: dev/libertas.fth ============================================================================== --- dev/libertas.fth Fri Jul 2 04:58:02 2010 (r1859) +++ dev/libertas.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -718,7 +718,10 @@ +xw outbuf-wait drop ; -: set-ap-mode ( -- ) 2 set-mode ; \ Thin firmware only +0 value ap-mode? +: set-ap-mode ( -- ) 2 set-mode true to ap-mode? ; \ Thin firmware only +: set-sta-mode ( -- ) 1 set-mode false to ap-mode? ; \ Thin firmware only +: set-passive-mode ( -- ) 0 set-mode false to ap-mode? ; \ Thin firmware only
: broadcast-mac$ ( -- adr len ) " "(ff ff ff ff ff ff)" ;
@@ -1028,6 +1031,7 @@ \ It prevents listening stations, of which there can be many, \ from transmitting when they come on-line. 2dup " olpc-mesh" $= if passive-scan then + 2dup " olpc-NANDblaster" $= if passive-scan then
h# 32 min scan-ssid pack drop ; @@ -1861,6 +1865,7 @@ : close ( -- ) opencount @ 1- 0 max opencount ! opencount @ 0= if + ap-mode? if set-sta-mode then adhoc-started? if adhoc-stop then disable-multicast mesh-stop drop @@ -1903,40 +1908,6 @@ recycle-packet ( actual ) ;
-\ Normal read and write methods. -: write ( adr len -- actual ) - link-up? 0= if 2drop 0 exit then \ Not associated yet. - ?reassociate \ In case if the connection is dropped - write-force -; -: read ( adr len -- actual ) - \ If a good receive packet is ready, copy it out and return actual length - \ If a bad packet came in, discard it and return -1 - \ If no packet is currently available, return -2 - - link-up? 0= if 2drop 0 exit then \ Not associated yet. - ?reassociate \ In case if the connection is dropped - read-force -; - -: load ( adr -- len ) - link-up? 0= if drop 0 exit then \ Not associated yet. - - " obp-tftp" find-package if ( adr phandle ) - my-args rot open-package ( adr ihandle|0 ) - else ( adr ) - 0 ( adr 0 ) - then ( adr ihandle|0 ) - - dup 0= if ." Can't open obp-tftp support package" stop-nic abort then - ( adr ihandle ) - - >r - " load" r@ ['] $call-method catch ( len false | x x x true ) - r> close-package - throw -; - 0 instance value /packet : find-tag ( tag-id #fixed-params -- false | tag-adr tag-len true ) +pkt-data ( tag-id adr ) @@ -2014,8 +1985,6 @@ : throttle delay ms ; \ Convert an 802.3 frame to an 802.11 frame and send it : thin-send-data-frame ( adr len -- len ) - begin backlog 8 >= while process-mgmt-frame repeat - backlog 1+ to backlog tuck over >r ( len adr len r: adr ) \ In 208, 200 is the fromDS bit, indicating that the frame is ostensibly coming \ from an AP, and 8 is the code for a non-acked Data frame. @@ -2024,6 +1993,8 @@ " "(aa aa 03 00 00 00)" 0 +pkt-data swap move ( len adr' elen ) tuck 6 +pkt-data swap move ( len elen ) packet-buf swap /802.11-header + 6 + wrap-802.11 ( len padr plen ) + begin backlog 8 >= while process-mgmt-frame repeat + backlog 1+ to backlog data-out ( len ) throttle ; @@ -2037,6 +2008,44 @@ test-buf d# 1440 thin-send-data-frame drop ;
+\ Normal read and write methods. +: write ( adr len -- actual ) + ap-mode? if + thin-send-data-frame + else + link-up? 0= if 2drop 0 exit then \ Not associated yet. + ?reassociate \ In case if the connection is dropped + write-force + then +; +: read ( adr len -- actual ) + \ If a good receive packet is ready, copy it out and return actual length + \ If a bad packet came in, discard it and return -1 + \ If no packet is currently available, return -2 + + link-up? 0= if 2drop 0 exit then \ Not associated yet. + ?reassociate \ In case if the connection is dropped + read-force +; + +: load ( adr -- len ) + link-up? 0= if drop 0 exit then \ Not associated yet. + + " obp-tftp" find-package if ( adr phandle ) + my-args rot open-package ( adr ihandle|0 ) + else ( adr ) + 0 ( adr 0 ) + then ( adr ihandle|0 ) + + dup 0= if ." Can't open obp-tftp support package" stop-nic abort then + ( adr ihandle ) + + >r + " load" r@ ['] $call-method catch ( len false | x x x true ) + r> close-package + throw +; + : reset ( -- flag ) reset-nic ;
: (scan-wifi) ( -- error? )
Modified: ofw/wifi/wifi-cfg.fth ============================================================================== --- ofw/wifi/wifi-cfg.fth Fri Jul 2 04:58:02 2010 (r1859) +++ ofw/wifi/wifi-cfg.fth Sat Jul 3 20:09:47 2010 (r1860) @@ -49,6 +49,8 @@ wifi-cfg /wifi-cfg erase ( adr len ) wifi-cfg >wc-ssid pstr! ( ) true to ssid-reset? + \ When an explicit SSID is given, don't fall back to the default list + ['] null$ to default-ssids ;
: $wep ( wep$ -- )