mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
List overview
Download
openfirmware
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
openfirmware@openfirmware.info
3007 discussions
Start a n
N
ew thread
[commit] r3577 - forth/wrapper
by repository service
01 Mar '13
01 Mar '13
Author: wmb Date: Fri Mar 1 10:00:57 2013 New Revision: 3577 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3577
Log: ARM - fixed wrapper to avoid Segmentation Violations when compiled for the SYSV ABI, which disallows self-modifying code by default. The solution is to call mprotect(..., PROT_READ | PROT_WRITE | PROT_EXEC); Modified: forth/wrapper/wrapper.c Modified: forth/wrapper/wrapper.c ============================================================================== --- forth/wrapper/wrapper.c Wed Feb 27 10:16:19 2013 (r3576) +++ forth/wrapper/wrapper.c Fri Mar 1 10:00:57 2013 (r3577) @@ -56,6 +56,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/mman.h> /* * The following #includes and externs fix GCC warnings when compiled with @@ -1011,7 +1012,12 @@ # endif # endif +#if defined(__linux__) && defined(ARM) + /* This is a hack to make sure loadaddr is page-aligned for mprotect() in s_flushcache() */ + loadaddr = (char *)sbrk(memsize); +#else loadaddr = (char *)m_alloc(memsize); +#endif if ((loadaddr == (char *) -1) || (loadaddr == (char *) 0)) { error("forth: Can't get memory",""); exit(1); @@ -2195,6 +2201,7 @@ return 0L; #endif #if defined(__linux__) && defined(ARM) + mprotect(adr, len, PROT_READ | PROT_WRITE | PROT_EXEC); __clear_cache(adr, adr+len); return 0L; #endif
1
0
0
0
[commit] r3576 - cpu/arm/olpc
by repository service
27 Feb '13
27 Feb '13
Author: quozl Date: Wed Feb 27 10:16:19 2013 New Revision: 3576 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3576
Log: OLPC XO-4 - increase deactivate delay, SMT text fixture and C2 seem to need it, #12583. Modified: cpu/arm/olpc/nn-touchscreen.fth Modified: cpu/arm/olpc/nn-touchscreen.fth ============================================================================== --- cpu/arm/olpc/nn-touchscreen.fth Wed Feb 27 05:25:20 2013 (r3575) +++ cpu/arm/olpc/nn-touchscreen.fth Wed Feb 27 10:16:19 2013 (r3576) @@ -170,7 +170,7 @@ : start ( -- ) h# 04 h# 01 h# ee 3 bytes-out ; : deactivate ( -- ) - h# 00 h# 01 h# ee 3 bytes-out h# 00 d# 100 anticipate + h# 00 h# 01 h# ee 3 bytes-out h# 00 d# 200 anticipate ; : deconfigure ( -- )
1
0
0
0
[commit] r3575 - cpu/x86/pc/olpc
by repository service
27 Feb '13
27 Feb '13
Author: quozl Date: Wed Feb 27 05:25:20 2013 New Revision: 3575 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3575
Log: OLPC XO-1 - backport serial terminal, without logging, tested without r3569 (breaks build). Modified: cpu/x86/pc/olpc/fw.bth cpu/x86/pc/olpc/terminal.fth Modified: cpu/x86/pc/olpc/fw.bth ============================================================================== --- cpu/x86/pc/olpc/fw.bth Tue Feb 26 19:38:09 2013 (r3574) +++ cpu/x86/pc/olpc/fw.bth Wed Feb 27 05:25:20 2013 (r3575) @@ -657,6 +657,7 @@ : enable-serial ; fload ${BP}/cpu/x86/pc/olpc/charge.fth \ Fancy battery charge logger fload ${BP}/cpu/x86/pc/olpc/diskspeed.fth \ Mass storage speed test +fload ${BP}/cpu/x86/pc/olpc/terminal.fth \ Serial terminal emulator fload ${BP}/cpu/x86/pc/olpc/apt.fth \ Common developer utilities tag-file @ fclose tag-file off Modified: cpu/x86/pc/olpc/terminal.fth ============================================================================== --- cpu/x86/pc/olpc/terminal.fth Tue Feb 26 19:38:09 2013 (r3574) +++ cpu/x86/pc/olpc/terminal.fth Wed Feb 27 05:25:20 2013 (r3575) @@ -199,8 +199,12 @@ 0 value serial-ih : usb-open ( -- ) - " /usb/serial" open-dev dup 0= abort" can't open USB serial adapter" - to serial-ih + " /usb/serial" open-dev ?dup if to serial-ih exit then +[ifdef] olpc-cl1 + " /usb@f,4/serial" open-dev ?dup if to serial-ih exit then + " /usb@f,5/serial" open-dev ?dup if to serial-ih exit then +[then] + true abort" can't open USB serial adapter" ; : usb-close ( -- ) @@ -313,6 +317,7 @@ : serial serial{ {serial} }serial ; +[ifdef] log-ih : serial-log ( "filename" -- ) serial{ safe-parse-word $create-file to log-ih @@ -322,6 +327,7 @@ log-ih close-dev }serial ; +[then] : use-uart use-uart ; : use-usb use-usb ;
1
0
0
0
[commit] r3574 - cpu/arm/olpc/4.0
by repository service
26 Feb '13
26 Feb '13
Author: wmb Date: Tue Feb 26 19:38:09 2013 New Revision: 3574 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3574
Log: Q7B19 Modified: cpu/arm/olpc/4.0/fw-version.fth Modified: cpu/arm/olpc/4.0/fw-version.fth ============================================================================== --- cpu/arm/olpc/4.0/fw-version.fth Tue Feb 26 01:49:40 2013 (r3573) +++ cpu/arm/olpc/4.0/fw-version.fth Tue Feb 26 19:38:09 2013 (r3574) @@ -1,7 +1,7 @@ \ The overall firmware revision macro: FW_PREFIX Q7 macro: FW_MAJOR B -macro: FW_MINOR 18 +macro: FW_MINOR 19 \ Create a 2-character build/fw-suffix file to personalize your test builds " fw-suffix" $file-exists? [if]
1
0
0
0
[commit] r3573 - cpu/arm/olpc/4.0
by repository service
26 Feb '13
26 Feb '13
Author: quozl Date: Tue Feb 26 01:49:40 2013 New Revision: 3573 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3573
Log: Q7B18 Modified: cpu/arm/olpc/4.0/fw-version.fth Modified: cpu/arm/olpc/4.0/fw-version.fth ============================================================================== --- cpu/arm/olpc/4.0/fw-version.fth Tue Feb 26 01:39:38 2013 (r3572) +++ cpu/arm/olpc/4.0/fw-version.fth Tue Feb 26 01:49:40 2013 (r3573) @@ -1,7 +1,7 @@ \ The overall firmware revision macro: FW_PREFIX Q7 macro: FW_MAJOR B -macro: FW_MINOR 17 +macro: FW_MINOR 18 \ Create a 2-character build/fw-suffix file to personalize your test builds " fw-suffix" $file-exists? [if]
1
0
0
0
[commit] r3572 - cpu/arm/olpc/4.0
by repository service
26 Feb '13
26 Feb '13
Author: rsmith Date: Tue Feb 26 01:39:38 2013 New Revision: 3572 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3572
Log: OLPC XO-4 - EC Code 0.4.00 Modified: cpu/arm/olpc/4.0/ec-version.fth Modified: cpu/arm/olpc/4.0/ec-version.fth ============================================================================== --- cpu/arm/olpc/4.0/ec-version.fth Mon Feb 25 21:40:19 2013 (r3571) +++ cpu/arm/olpc/4.0/ec-version.fth Tue Feb 26 01:39:38 2013 (r3572) @@ -1,6 +1,6 @@ \ The EC microcode macro: EC_PLATFORM cl4 -macro: EC_VERSION 7_0_3_13 +macro: EC_VERSION 7_0_4_00 \ Alternate command for getting EC microcode, for testing new versions. \ Temporarily uncomment the line and modify the path as necessary
1
0
0
0
[commit] r3571 - dev/bluetooth
by repository service
25 Feb '13
25 Feb '13
Author: wmb Date: Mon Feb 25 21:40:19 2013 New Revision: 3571 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3571
Log: Bluetooth diagnostic - turn of scanning when closing the Bluetooth device. Modified: dev/bluetooth/marvell-hci.fth Modified: dev/bluetooth/marvell-hci.fth ============================================================================== --- dev/bluetooth/marvell-hci.fth Mon Feb 25 09:35:53 2013 (r3570) +++ dev/bluetooth/marvell-hci.fth Mon Feb 25 21:40:19 2013 (r3571) @@ -942,6 +942,7 @@ true ; : close ( -- ) + disable-scanning outbuf h# 200 " free-buffer" $call-parent ; : selftest ( -- error? )
1
0
0
0
[commit] r3570 - dev/bluetooth
by repository service
25 Feb '13
25 Feb '13
Author: wmb Date: Mon Feb 25 09:35:53 2013 New Revision: 3570 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3570
Log: Added Bluetooth diagnostic driver. Added: dev/bluetooth/marvell-hci.fth Added: dev/bluetooth/marvell-hci.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ dev/bluetooth/marvell-hci.fth Mon Feb 25 09:35:53 2013 (r3570) @@ -0,0 +1,980 @@ + +\ h# 00 constant config-reg \ 03 for 8688 +\ h# 02 constant host-int-mask-reg \ 04 for 8688 +\ h# 03 constant host-intstatus-reg \ 05 for 8688 +\ h# 30 constant card-status-reg \ 20 for 8688 +\ h# 40 constant sq-read-base-addr-a0-reg \ 10 for 8688 +\ h# 41 constant sq-read-base-addr-a1-reg \ 11 for 8688 +\ h# 5c constant card-revision-reg \ ?? for 8688 +\ h# 60 constant card-fw-status0-reg \ 40 for 8688 +\ h# 61 constant card-fw-status1-reg \ 41 for 8688 +\ h# 62 constant card-rx-len-reg \ 42 for 8688 +\ h# 63 constant card-rx-unit-reg \ 43 for 8688 +\ h# 78 constant ioport0-reg \ 00 for 8688 +\ h# 79 constant ioport1-reg \ 01 for 8688 +\ h# 7a constant ioport2-reg \ 02 for 8688 + +h# 200 value SDIO_BLOCK_SIZE + +\ The data in the result buffer does not include the event code +\ the command code, or the error status byte. +\ /result does not count those either, but only the excess result +\ bytes following the error status byte. + +h# 80 buffer: result-buf +0 value /result + +: copy-result ( adr -- ) + \ "4 -" omits the event count, the ocf_ogf field, and the error status byte + dup 1+ c@ 4 - to /result ( adr ) + \ "6 +" skips the event code, the length byte, and the 4 bytes cited above. + 6 + result-buf /result move ( ) +; + +: .vendor-cmd ( adr ocf process? -- adr ocf process? ) + ." Vendor command " over .x ( adr ocf process? ) + 2 pick 5 + c@ ?dup if ( adr ocf process? error ) + ." failed with error " .x cr ( adr ocf process? ) + else ( adr ocf process? ) + ." succeeded" cr ( adr ocf process? ) + then ( adr ocf process? ) +; + +h# 4e constant #events +create events h# 4e /token * allot + +: check-event# ( event# -- ) #events >= abort" Too many events" ; +: xt-set-event ( event# xt -- ) over check-event# events rot ta+ token! ; +: set-event ( event# -- ) lastacf xt-set-event ; +: UNKNOWN ( -- ) ; +: UNUSED ( n -- ) ['] UNKNOWN xt-set-event ; + +h# 00 UNUSED + +: inquiry-complete \ b.status + cdump cr +; h# 01 set-event + +: inquiry-result \ b.nresp { bdaddr b.pscan-rep-mode b.pscan-period-mode b.pscan-mode b.dev-class[3] w.clock-offset } + cdump cr +; h# 02 set-event + +: conn-complete \ b.status w.handle bdaddr b.link-type b.encr-mode + cdump cr +; h# 03 set-event + +: conn-request \ bdaddr b.dev-class[3] b.link-type + cdump cr +; h# 04 set-event + +: disconn-complete \ b.status w.handle b.reason + cdump cr +; h# 05 set-event + +: auth-complete \ b.status w.handle + cdump cr +; h# 06 set-event + +: remote-name \ b.status bdaddr b.name[248] + cdump cr +; h# 07 set-event + +: encrypt-change \ b.status w.handle b.encrypt + cdump cr +; h# 08 set-event + +: change-link-key-complete \ b.status w.handle + cdump cr +; h# 09 set-event + +: master-link-key-complete \ b.status w.handle b.flag + cdump cr +; h# 0a set-event + +: remote-features \ b.status w.handle b.features[8] + cdump cr +; h# 0b set-event + +: remote-version \ b.status w.handle b.lmp-ver w.manufacturer w.lmp-subver + cdump cr +; h# 0c set-event + +: qos-setup-complete \ b.status w.handle { b.service-type L.token-rate L.peak-bandwidth L.latency L.delay-variation} + cdump cr +; h# 0d set-event + +: cmd-complete \ b.ncmd w.opcode + ." Cmd " over 1+ le-w@ .x space + 3 /string cdump cr +; h# 0e set-event + +: cmd-status \ b.status b.ncmd w.opcode + cdump cr +; h# 0f set-event + +: hardware-error \ b.errorcode + cdump cr +; h# 10 set-event + +: flush-occurred \ w.handle + cdump cr +; h# 11 set-event + +: role-change \ b.status bdaddr b.role + cdump cr +; h# 12 set-event + +: num-comp-pkts \ b.num-hndl { w.handle w.count } + cdump cr +; h# 13 set-event + +: mode-change \ b.status w.handle b.mode w.interval + cdump cr +; h# 14 set-event + +: return-link-keys \ b.num { bdaddr, b.key[16] } + cdump cr +; h# 15 set-event + +: pin-code-req \ bdaddr + cdump cr +; h# 16 set-event + +: link-key-req \ bdaddr + cdump cr +; h# 17 set-event + +: link-key-notify \ bdaddr b.link-key[16] b.key-type + cdump cr +; h# 18 set-event + +: loopback-command \ [variable] + cdump cr +; h# 19 set-event + +: data-buffer-overflow \ b.link-type + cdump cr +; h# 1a set-event + +: max-slots-change \ w.handle b.lmp-max-slots + cdump cr +; h# 1b set-event + +: clock-offset \ b.status w.handle w.clock-offset + cdump cr +; h# 1c set-event + +: pkt-type-change \ b.status w.handle w.pkt-type + cdump cr +; h# 1d set-event + +: qos-violation \ w.handle + cdump cr +; h# 1e set-event + +h# 1f UNUSED + +: pscan-rep-mode \ bdaddr b.pscan-rep-mode + cdump cr +; h# 20 set-event + +: flow-specification-complete \ b.status w.handle b.flags b.direction b.service-type b.token-rate l.token-bucket-size l.bandwidth l.latency + cdump cr +; h# 21 set-event + +: inquiry-result-with-rssi \ b.nresp {bdaddr b.pscan-rep-mode b.pscan-period-mode b.dev-class[3] w.clock-offset S.rssi} + cdump cr +; h# 22 set-event + \ inquiry-info-with-rssi-and-pscan-mode \ b.nresp { bdaddr b.pscan-rep-mode b.pscan-period-mode b.pscan-mode b.dev-class[3] w.clock-offset S.rssi } + +: remote-ext-features \ b.status w.handle b.page b.max-page b.features[8] + cdump cr +; h# 23 set-event + +h# 2c h# 24 do i UNUSED loop + +: sync-conn-complete \ b.status w.handle bdaddr b.link-type b.tx-interval b.retrans-w.ndow. w.rx-pkt-len w.tx-pkt-len b.air-mode + cdump cr +; h# 2c set-event + +: sync-conn-changed \ b.status w.handle b.tx-interval b.retrans-w.ndow. w.rx-pkt-len w.tx-pkt-len + cdump cr +; h# 2d set-event + +: sniff-subrate \ b.status w.handle w.max-tx-latency w.max-rx-latency w.max-remote-timeout w.max-local-timeout + cdump cr +; h# 2e set-event + +: extended-inquiry-info \ b.nresp { bdaddr b.pscan-rep-mode b.pscan-period-mode b.dev-class[3] w.clock-offset S.rssi b.data[240] } + cdump cr +; h# 2f set-event + +: key-refresh-complete \ b.status w.handle + cdump cr +; h# 30 set-event + +: io-capa-request \ bdaddr + cdump cr +; h# 31 set-event + +: io-capa-reply \ bdaddr b.capability b.oob-data b.authentication + cdump cr +; h# 32 set-event + +: user-confirm-req \ bdaddr l.passkey + cdump cr +; h# 33 set-event + +: user-passkey-req \ bdaddr + cdump cr +; h# 34 set-event + +: remote-oob-data-request \ bdaddr + cdump cr +; h# 35 set-event + +: simple-pair-complete \ b.status bdaddr + cdump cr +; h# 36 set-event + +h# 37 UNUSED + +: link-supervision-timeout-changed \ w.handle w.timeout + cdump cr +; h# 38 set-event + +: enhanced-flush-complete \ w.handle + cdump cr +; h# 39 set-event + +h# 3a UNUSED + +: user-passkey-notification \ bdaddr l.passkey + cdump cr +; h# 3b set-event + +: keypress-notification \ bdaddr b.type + cdump cr +; h# 3c set-event + +: remote-host-features \ bdaddr b.features[8] + cdump cr +; h# 3d set-event + +: le-meta \ b.subevent + cdump cr +; h# 3e set-event + +\ 1 le-connection-complete \ b.status w.handle b.role b.peer-type 6.peer-addr w.interval w.latency w.timeout b.accuracy +\ 2 le-advertising-report \ b.num { b.event-type b.addr-type 6.address b.datalen { b.data } S.rssi } +\ 3 le-connection-update-complete \ b.status w.handle w.interval w.latency w.timeout +\ 4 le-read-remote-used-features-complete \ b.status w.handle 8.features +\ 5 le-long-term-key-request \ w.handle 8.random w.diversifier + +h# 3f UNUSED + +: physical-link-complete \ b.status b.plink + cdump cr +; h# 40 set-event + +: channel-selected \ b.plink + cdump cr +; h# 41 set-event + +: disconnection-phys-link-complete \ b.status b.plink b.reason + cdump cr +; h# 42 set-event + +: physical-link-loss-early-warning \ b.plink b.reason + cdump cr +; h# 43 set-event + +: physical-link-recovery \ b.plink + cdump cr +; h# 44 set-event + +: logical-link-complete \ b.status w.llink b.plink b.flow-spec-id + cdump cr +; h# 45 set-event + +: disconnection-log-link-complete \ b.status w.llink b.reason + cdump cr +; h# 46 set-event + +: flow-spec-modify-complete \ b.status w.handle + cdump cr +; h# 47 set-event + +: num-comp-blocks \ w.num-blocks b.num-hndl { w.handle w.pkts w.blocks } + cdump cr +; h# 48 set-event + +: amp-start-test \ b.status b.scenario + cdump cr +; h# 49 set-event + +: amp-test-end \ b.status b.scenario + cdump cr +; h# 4a set-event + +: amp-receiver-report \ b.ctlr-type b.reason l.event-type w.numfr + cdump cr +; h# 4b set-event + +: short-range-mode-change-complete \ b.status b.plink b.state + cdump cr +; h# 4c set-event + +: amp-status-change \ b.status b.amp-status + cdump cr +; h# 4d set-event + +: unwrap-event ( adr len -- adr' len' event# ) + drop >r ( r: adr ) + r@ 2 + r@ 1+ c@ r> c@ ( eadr elen event# ) +; +: .event ( adr len -- ) + ." Event: " ( adr len ) + unwrap-event ( adr' len' event# ) + dup #events >= if ( adr len event# ) + drop ." UNKNOWN " ( adr len ) + cdump cr ( ) + else ( adr len event# ) + events swap ta+ token@ ( adr len xt ) + dup .name ( adr len xt ) + execute ( ) + then ( ) +; + +\ If it is a vendor event, copy the result into a dedicated buffer +\ instead of returning the data to the caller +: x-check-evtpkt ( adr len -- process? ) + over c@ >r 2 /string r> ( adr' len' type ) + h# e = if \ EV_CMD_COMPLETE ( adr len ) + drop dup 1 + le-w@ d# 1024 /mod ( adr ocf ogf ) + \ For now we ignore ocf, but we could check if its value is h# 5b - + \ BT_CMD_MODULE_CFG_REQ - and do something to indicate completion + h# 3f <> ( adr ocf process? ) + dup 0= if ( adr ocf process? ) + 2 pick copy-result ( adr ocf process? ) + .vendor-cmd ( adr ocf process? ) + then ( ocf process? ) + nip nip ( process? ) + else ( adr len ) + 2drop true ( process? ) + then +; +: check-evtpkt ( adr len -- process? ) + .event false +; + +0 value psmode +: handle-marvell-event ( adr len -- process? ) + over c@ h# ff <> if 2drop true exit then \ Check for Marvell event + drop 2 + ( data-adr ) + dup c@ case ( data-adr type ) + + h# 23 of \ AUTO_SLEEP_MODE ( data-adr ) + dup 2+ c@ if ( data-adr ) + ." PS Mode command failed" cr ( data-adr ) + else ( data-adr ) + dup 1+ c@ 2 = to psmode ( data-adr ) + then ( data-adr ) + false ( data-adr process? ) + endof ( data-adr ) + + h# 59 of \ SLEEP_CONFIG ( data-adr ) + dup 3 + c@ if ( data-adr ) + ." HSCFG command failed" cr ( data-adr ) + then ( data-adr ) + false ( data-adr process? ) + endof ( data-adr type ) + + h# 5a of \ SLEEP_ENABLE ( data-adr ) + dup 1+ c@ if ( data-adr ) + ." HS Enable command failed" cr ( data-adr ) + else + \ true to sleep-activated? + then ( data-adr ) + false ( data-adr process? ) + endof ( data-adr type ) + + h# 5b of \ MODULE_CFG_REQ ( data-adr ) + \ Pass on everything except MODULE_BRINGUP_REQ and MODULE_SHUTDOWN_REQ + dup 1+ c@ h# f1 h# f2 between 0= ( data-adr process? ) + endof ( data-adr type ) + + ( default ) ( data-adr type ) + true swap ( data-adr process? type ) + endcase ( data-adr process? ) + + nip ( process? ) +; + +true instance value got-data? +0 instance value /data +0 instance value data + +: copy-data ( adr len buf+ actual -- actual ) + rot min ( adr buf+ actual' ) + -rot swap ( actual buf+ adr ) + 2 pick move ( actual ) +; + +h# 200 buffer: event-buf + +d# 1000 instance value bt-timeout +: normal-timeout ( -- ) d# 1000 to bt-timeout ; + +: timed-wait ( -- adr len type ) + get-msecs bt-timeout + ( time-limit ) + begin ( time-limit ) + dup get-msecs - 0< abort" Bluetooth timeout" ( time-limit ) + " got-bt-packet?" $call-parent ( time-limit [ dadr dlen type ] flag ) + until ( time-limit dadr dlen type ) + 3 roll drop ( dadr dlen type ) + rot event-buf ( dlen type dadr buf ) + 3 pick move ( dlen type ) + event-buf -rot ( adr len type ) + " recycle-packet" $call-parent ( adr len type ) +; + +0 instance value #cmds-allowed +: unwrap-cmd-complete ( eadr elen -- adr len cmd# ) + over c@ to #cmds-allowed ( eadr elen ) + 3 /string ( adr len ) + over 2- le-w@ ( eadr elen cmd# ) +; +: ?cmd-error ( adr -- ) + c@ ?dup if ( error# ) + ." Command failed with error 0x" .x cr + then +; + +: unwrap-cmd-status ( eadr elen -- adr len cmd# ) + over 1+ c@ to #cmds-allowed ( eadr elen ) + over ?cmd-error ( eadr elen ) + 4 /string ( adr len ) + over 2- le-w@ ( eadr elen cmd# ) +; + +: wait-event ( -- eadr elen event# ) + begin timed-wait 4 <> while ( dadr dlen ) + 2drop ( ) + repeat ( dadr dlen ) + unwrap-event ( eadr elen event# ) +; + +\ adr,len is the unwrapped command response data +: wait-cmd-complete ( cmd# -- adr len ) + >r ( r: cmd# ) + begin ( r: cmd# ) + wait-event h# e = if ( eadr elen r: cmd# ) + unwrap-cmd-complete ( cadr clen this-cmd# r: cmd# ) + r@ = if ( cadr clen r: cmd# ) + r> drop exit ( -- adr len ) + then ( cadr clen r: cmd# ) + then ( adr len r: cmd# ) + 2drop ( r: cmd# ) + again +; + +: wait-cmd-status ( -- ) + begin ( ) + wait-event h# f = if ( eadr elen ) + unwrap-cmd-status ( cadr clen this-cmd# ) + 3drop exit ( -- ) + then ( adr len ) + 2drop ( ) + again +; + +: le-3@ ( adr -- n ) le-l@ h# ffffff and ; +: <c@ ( adr -- ) c@ dup h# 80 and if d# 256 - then ; +: .dbm ( adr -- ) <c@ .d ." dBm " ; +: show-pscan ( adr -- ) ." Rep: " c@ . ; +: show-class ( adr -- ) ." Class: 0x" le-3@ .x ; +: show-bdaddr ( adr -- ) ." BDADDR: " 6 cdump ; +: show-offset ( adr -- ) ." Offset: 0x" le-w@ .x ; +: show-rssi ( adr -- ) ." RSSI: " .dbm ; + +: parse-inquiry ( eadr elen -- ) + over c@ >r 1 /string r> ( adr' len' #responses ) + 0 ?do ( adr len ) + over show-bdaddr ( adr len ) + over 7 + show-pscan ( adr len ) + over 9 + show-class ( adr len ) + over d# 12 + show-offset ( adr len ) + cr ( adr len ) + d# 14 /string ( adr' len' ) + loop ( adr len ) + 2drop +; + +: show-inquiry-rssi ( adr -- ) + dup show-bdaddr ( adr ) + dup 7 + show-pscan ( adr len ) + dup 8 + show-class ( adr ) + dup d# 11 + show-offset ( adr ) + d# 13 + show-rssi ( ) +; +: parse-inquiry-rssi ( eadr elen -- ) + over c@ >r 1 /string r> ( adr' len' #responses ) + 0 ?do ( adr len ) + over show-inquiry-rssi cr ( adr len ) + d# 14 /string ( adr' len' ) + loop ( adr len ) + 2drop +; + +: .tx-power ( adr len -- adr len ) ." TX_Power: " over 1+ .dbm ; +: .short-name ( adr len -- adr len ) ." Short_Name: " 2dup 1 /string type space ; +: .long-name ( adr len -- adr len ) ." Name: " 2dup 1 /string type space ; +: show-extended-inquiry ( adr -- ) + begin dup c@ dup while ( adr len ) + swap 1+ tuck c@ ( adr' len type ) + case ( adr len type ) + \ 1 is flags + \ 2-7 are service UUIDs + 8 of .short-name endof ( adr len type ) + 9 of .long-name endof ( adr len type ) + h# a of .tx-power endof ( adr len type ) + \ h# d-f are simple pairing OOB tags + \ h# 10 is security manager TK value + \ h# 11 is security manager OOB flags + \ h# 12 is slave connection interval range + \ h# 14-15 are service solicitation UUIDS + \ h# 16 is service data + \ h# ff is manufacturer-specific data + endcase ( adr len ) + + ( adr' ) + repeat ( adr len ) + 2drop +; + +: parse-extended-inquiry ( eadr elen -- ) + over c@ >r 1 /string r> ( adr' len' #responses ) + 0 ?do ( adr len ) + over show-inquiry-rssi cr ( adr len ) + d# 14 /string ( adr' len' ) + over show-extended-inquiry ( adr len ) + cr cr ( adr len ) + h# f0 /string ( adr len ) + loop ( adr len ) + 2drop +; + +\ adr,len is the unwrapped command response data +: process-inquiry ( -- ) + begin ( ) + wait-event case ( eadr elen event# ) + 1 of \ Inquiry Complete ( eadr elen ) + drop ?cmd-error ( ) + exit + endof + + 2 of \ Inquiry Result ( eadr elen ) + parse-inquiry ( ) + endof ( eadr elen event# ) + + h# f of \ Command Status ( eadr elen ) + unwrap-cmd-status ( eadr elen cmd# ) + drop ." Inquiry results:" cr + endof ( eadr elen event# ) + + h# 22 of \ Inquiry Info w/RSSI ( eadr elen ) + parse-inquiry-rssi ( ) + endof ( eadr elen event# ) + + h# 2f of \ Extended Inquiry Info ( eadr elen ) + parse-extended-inquiry ( ) + endof ( eadr elen event# ) + + \ default ( eadr elen event# ) + \ nip nip ( event# ) + ." Skipping event# " dup . ( eadr elen event# ) + 2 spaces -rot cdump cr ( event# ) + endcase ( ) + again +; + +: read ( adr len -- actual ) + " got-bt-packet?" $call-parent 0= if ( adr len ) + 2drop -2 exit + then ( adr len dadr dlen type ) + + case ( adr len dadr dlen type ) + + h# fe of \ VENDOR ( adr len dadr dlen ) + 2dup handle-marvell-event if ( adr len dadr dlen ) + copy-data ( actual ) + else ( adr len dadr dlen ) + 4drop -1 ( -1 ) + then ( actual ) + endof ( adr len dadr dlen type ) + + 4 of \ EVENT ( adr len dadr dlen ) + 2dup check-evtpkt if ( adr len dadr dlen ) + copy-data ( actual ) + else ( adr len dadr dlen ) + 4drop -1 ( actual ) + then ( ) + endof ( adr len dadr dlen type ) + + 2 of \ ACLDATA ( adr len dadr dlen ) + copy-data ( actual ) + endof ( adr len dadr dlen type ) + + 3 of \ SCODATA ( adr len ) + copy-data ( actual ) + endof ( adr len dadr dlen type ) + + ( default ) ( adr len dadr len type ) + dup ." Invalid BT SDIO packet type " .d cr + nip nip nip nip -1 swap ( actual type ) + endcase ( actual ) + + " recycle-packet" $call-parent ( actual ) +; +0 instance value outbuf +: host-to-card ( adr len -- ) + SDIO_BLOCK_SIZE round-up ( adr len' ) + 2 0 do ( adr len ) + 2dup " sdio-blocks!" $call-parent ( adr len actual ) + over = if 2drop unloop exit then ( adr len ) + loop ( adr len ) + 2drop ( ) + true abort" BT SDIO write failed" ( ) +; + +\ Command packet: +\ SDIO Type-A Transport header +\ 0..2 Length of interface data (after byte 3) +\ 3 Service ID: 1=HCI 2=ACL 3=SCO 4=Event FE=Vendor +\ Command header +\ 4..5 Command code - OGF<<10 | OCF +\ 6 Length of command data (after byte 6) +\ Command data +\ 7.. Varies according to command + +: 'cmd-data ( -- adr ) outbuf 7 + ; + +: send-cmd ( data-len ogf+ocf service-id -- ) + outbuf 3 + c! ( ogf+ocf ) + outbuf 4 + le-w! ( data-len ) + dup outbuf 6 + c! ( data-len ) + 3 + dup outbuf le-w! ( len-wo-transport-hdr ) + outbuf swap 4 + host-to-card ( ) +; + +0 value x \ Temporary variables to assist command creation +0 value /x + +: 'x ( -- adr ) x /x + ; +: +x ( n -- ) /x + to /x ; +: +x$ ( $ -- ) 'x swap dup +x move ; +: +x3 ( n -- ) 'x le-l! 3 +x ; +: +xl ( n -- ) 'x le-l! /l +x ; +: +xw ( n -- ) 'x le-w! /w +x ; +: +xb ( n -- ) 'x c! /c +x ; +: +xerase ( n -- ) 'x over erase +x ; +: +xbdaddr ( 'bdaddr -- ) 6 +x$ ; + +: cmd( ( -- ) 'cmd-data to x 0 to /x ; +: )cmd ( cmd# -- ) /x swap 1 send-cmd ; +: )cmd-wait ( cmd# -- ) dup )cmd wait-cmd-complete ; +: )vendor-cmd ( cmd# -- ) /x swap h# fe send-cmd ; +: )vendor-cmd-wait ( cmd# -- adr len ) /x swap h# fe send-cmd wait-cmd-complete ; + +: send-vendor-cmd ( data-len cmd-code -- ) + h# fc00 or h# fe send-cmd ( ) \ fe is Vendor command service ID +; +: send-hci-cmd ( data-len cmd# -- ) + 1 send-cmd ( ) \ 1 is HCI command service ID +; +: do-hci-cmd ( data-len cmd# -- adr len ) + tuck 1 send-cmd ( cmd# ) + wait-cmd-complete ( adr len ) +; + +: send-rev-cmd ( -- ) 0 h# f send-vendor-cmd ; +: send-read-mem-cmd ( reg# len -- ) + 'cmd-data 4 + c! ( reg# ) + 'cmd-data le-l! ( ) + 5 h# 1 send-vendor-cmd +; + +: +cmd ( offset -- adr ) 'cmd-data + ; +: cmd! ( n offset -- ) +cmd c! ; + +: send-rx-test ( #reports 'bdaddr tx-am len #packets type rxfreq txfreq scenario -- ) + cmd( + +xb \ scenario + +xb \ txfreq + +xb \ rxfreq + +xb \ type + +xl \ #packets + +xw \ len + +xb \ tx-am + +xbdaddr \ bdaddr + +xb \ #reports + + h# fc05 )vendor-cmd-wait 2drop +; +: rx-test ( -- ) +\ #r bdaddr am len #p DM1 rxf txf 0pat + 0 " abcdef" drop 1 d# 10 1 3 0 1 1 send-rx-test +; +: giac ( -- adr len ) " "(33 8b 9e)" ; + +: set-scan ( mask -- ) cmd( +xb h# c1a )cmd-wait 2drop ; +: enable-scanning ( -- ) 3 set-scan ; +: disable-scanning ( -- ) 0 set-scan ; + +: set-inquiry-mode ( 0|1|2-- ) + cmd( +xb h# c45 )cmd-wait drop ?cmd-error +; +: cancel-inquiry ( -- ) cmd( h# 402 )cmd-wait drop ?cmd-error ; + +: x-send-inquiry ( -- ) + h# 33 0 cmd! h# 8b 1 cmd! h# 9e 2 cmd! \ General Inquiry LAC + 4 3 cmd! \ 4 * 1.28 seconds + 1 4 cmd! \ Return after first response + 5 h# 401 send-hci-cmd +; +: olpc-in-extended-inquiry? ( adr -- flag ) + begin dup c@ dup while ( adr len ) + swap 1+ tuck c@ ( adr' len type ) + 8 9 between if ( adr len ) + 2dup 1 /string ( adr len remote-name$ ) + " OLPC-XO" $= if ( adr len ) + 2drop true exit ( -- true ) + then + then ( adr len ) + + ( adr' ) + repeat ( adr len ) + 2drop false ( false ) +; +: olpc-xo-found? ( eadr elen -- seen? ) + over c@ >r 1 /string r> ( adr' len' #responses ) + 0 ?do ( adr len ) + d# 14 /string ( adr' len' ) + over olpc-in-extended-inquiry? if ( adr len ) + 2drop true unloop exit ( -- true ) + then ( adr len ) + h# f0 /string ( adr len ) + loop ( adr len ) + 2drop false ( false ) +; + +: wait-olpc-response ( -- seen? ) + begin ( ) + wait-event case ( eadr elen event# ) + 1 of \ Inquiry Complete ( eadr elen ) + drop ?cmd-error ( ) + false exit ( -- false ) + endof + + h# 2f of \ Extended Inquiry Info ( eadr elen ) + olpc-xo-found? if ( ) + cancel-inquiry ( ) + true exit ( -- true ) + then + endof ( eadr elen event# ) + + \ default ( eadr elen event# ) + nip nip ( event# ) + endcase ( ) + again +; +: send-inquiry ( -- ) + cmd( + giac +x$ \ General Inquiry LAC + d# 4 +xb \ 4 * 1.28 seconds + d# 16 +xb \ #responses + h# 401 )cmd + wait-cmd-status +; +: inquire ( -- ) + d# 10000 to bt-timeout + send-inquiry + process-inquiry + normal-timeout +; +: inquire-olpc? ( -- seen? ) + 2 set-inquiry-mode + d# 7000 to bt-timeout + send-inquiry + wait-olpc-response ( seen? ) + normal-timeout +; + +6 instance buffer: his-bdaddr +6 instance buffer: my-bdaddr +: read-bdaddr ( -- ) + cmd( h# 1009 )cmd-wait ( adr len ) + over c@ if ( adr len ) + ." Bluetooth read-bdaddr command failed!" cr + 2drop exit + then + drop 1+ my-bdaddr 6 move +; + +: .bdaddr ( 'bdaddr -- ) 6 cdump space ; + +0 instance value the-connection +: parse-connection ( adr -- ) + dup c@ if drop exit then ( adr ) + dup 1+ le-w@ to the-connection + ." Connected to " dup 3 + .bdaddr ( adr ) + dup 9 + c@ case + 0 of ." SOC" endof + 1 of ." ACL" endof + endcase + dup d# 10 + c@ if ." Encrypted" then + cr + drop +; +: wait-connected ( -- ) + begin ( ) + wait-event case ( eadr elen event# ) + 3 of \ Connection Complete ( eadr elen ) + drop dup ?cmd-error ( eadr ) + parse-connection + exit + endof + + \ default ( eadr elen event# ) + \ nip nip ( event# ) + ." Skipping event# " dup . ( eadr elen event# ) + 2 spaces -rot cdump cr ( event# ) + endcase ( ) + again +; + +h# cc18 value packet-types +0 value his-clock-offset +: connect ( 'bdaddr -- ) + cmd( ( 'bdaddr ) + +xbdaddr ( ) + packet-types +xw + 0 +xb \ Page Scan Mode R0 + 0 +xb \ Reserved, must be 0 + his-clock-offset +xw + 0 +xb \ Disallow Role Switch + h# 405 )cmd wait-cmd-status +; +: wait-disconnected ( -- ) + begin ( ) + wait-event case ( eadr elen event# ) + 5 of \ Disconnection Complete ( eadr elen ) + drop ?cmd-error ( eadr ) + exit + endof + + \ default ( eadr elen event# ) + \ nip nip ( event# ) + ." Skipping event# " dup . ( eadr elen event# ) + 2 spaces -rot cdump cr ( event# ) + endcase ( ) + again +; + +: disconnect ( -- ) + cmd( the-connection +xw h# 13 +xb h# 406 )cmd + wait-cmd-status wait-disconnected +; + +: set-name ( name$ -- ) + cmd( d# 248 over - -rot +x$ +xerase h# c13 )cmd-wait + drop ?cmd-error +; +: get-name ( -- name$ ) + cmd( h# c14 )cmd-wait + over ?cmd-error ( adr len ) + over c@ if 2drop " " else ( adr len ) + drop 1+ cscount ( name$ ) + then ( name$ ) +; +: wait-remote-name ( -- name$ ) + begin ( ) + wait-event case ( eadr elen event# ) + 7 of \ Remote Name Request Complete ( eadr elen ) + drop dup ?cmd-error ( eadr ) + 7 + cscount exit ( -- adr len ) + endof + + \ default ( eadr elen event# ) + \ nip nip ( event# ) + ." Skipping event# " dup . ( eadr elen event# ) + 2 spaces -rot cdump cr ( event# ) + endcase ( ) + again +; + +: get-remote-name ( offset rep bdaddr -- name$ ) + cmd( +xbdaddr +xb 0 +xb +xw h# 419 )cmd wait-cmd-status + wait-remote-name ( name$ ) +; + +: set-class ( class# -- ) + cmd( +x3 h# c24 )cmd-wait drop ?cmd-error +; +: set-my-class ( -- ) h# 10010c set-class ; \ Laptop computer, transfer + +: set-extended-response ( adr len fec? -- ) + cmd( +xb +x$ h# f0 /x 1- - +xerase h# c52 )cmd-wait drop ?cmd-error +; +: set-olpc-xo-response ( -- ) + " "(08 09)OLPC-XO" false set-extended-response +; +: start-server ( -- ) + " OLPC-XO" set-name \ Not strictly necessary + enable-scanning + set-olpc-xo-response +; + +: open ( -- flag ) + my-space " set-address" $call-parent + h# 200 " set-block-size" $call-parent + h# 200 " alloc-buffer" $call-parent to outbuf + my-args " scan" $= if start-server then + true +; +: close ( -- ) + outbuf h# 200 " free-buffer" $call-parent +; +: selftest ( -- error? ) + open 0= if + ." Can't open Bluetooth device" cr + true exit + then + inquire-olpc? 0= + dup if ." No response from Bluetooth scan server" cr then +; +also forth definitions +: scan-bt ( -- ) + " /bluetooth:scan" open-dev ( ihandle ) + ?dup if ( ihandle ) + ." Bluetooth scan server started. Type a key to exit" cr + begin key? until key drop ( ihandle ) + close-dev ( ) + else + ." Can't start Bluetooth scan server." cr + then +; +previous definitions + +\ Classes: +\ Information: 800000 +\ Telephony: 400000 +\ Audio 200000 +\ Object xfer 100000 +\ Capturing 80000 +\ Rendering 40000 +\ Networking 20000 +\ Positioning 10000 +\ Limited discoverable mode 2000 +\ Major: Computer 100, Phone 200, LAN AP 300, AV 400, Peripheral 500, Imaging 600, Wearable 700, Toy 800, Misc 000, Uncategorized 1f00 +\ Minor: major-dependent, e.g. 204 is cell phone +\ P2030 phone: 51 04 8c 68 30 2c Class: 5a0204
1
0
0
0
[commit] r3569 - in dev: . bluetooth mmc/sdhci mmc/sdhci/mv8686 usb2/device/wlan
by repository service
25 Feb '13
25 Feb '13
Author: wmb Date: Mon Feb 25 09:34:36 2013 New Revision: 3569 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3569
Log: Marvell WLAN driver - Omnibus checkin of changes to the SDIO layer to make it easier to share code with the Bluetooth driver. The particular advantage is to eliminate duplication of firmware downloading between the WLAN and BT drivers. Added: dev/bluetooth/ Modified: dev/libertas.fth dev/mmc/sdhci/mv8686/common.fth dev/mmc/sdhci/mv8686/fw8686.fth dev/mmc/sdhci/mv8686/loadpkg.fth dev/mmc/sdhci/mv8686/mv8686.fth dev/mmc/sdhci/mv8686/sdio.fth dev/mmc/sdhci/sdhci.fth dev/usb2/device/wlan/fw8388.fth dev/usb2/device/wlan/usb8388.bth dev/usb2/device/wlan/usb8388.fth dev/usb2/device/wlan/wlan.fth Modified: dev/libertas.fth ============================================================================== --- dev/libertas.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/libertas.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -4,6 +4,22 @@ headers hex +false instance value debug? + +: debug-on ( -- ) true to debug? ; +: vdump ( adr len -- ) debug? if " dump" evaluate else 2drop then ; + +create mac-adr 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, +6 constant /mac-adr +: mac-adr$ ( -- adr len ) mac-adr /mac-adr ; + +: max-frame-size ( -- size ) d# 1514 ; + +external +defer get-mac-address ( -- adr len ) ' mac-adr$ to get-mac-address +headers + + \ **************** WPA and WPA2 are not functional yet ****************** \ ======================================================================= @@ -21,7 +37,6 @@ : .scan ( adr -- ) " .scan" $call-supplicant ; : .ssids ( adr len -- ) " .ssids" $call-supplicant ; -defer load-all-fw ( -- error? ) ' false to load-all-fw defer ?process-eapol ['] 2drop to ?process-eapol 0 value outbuf @@ -32,10 +47,10 @@ \ Override as necessary : init-buf ( -- ) - outbuf 0= if /outbuf dma-alloc to outbuf then + outbuf 0= if /outbuf " alloc-buffer" $call-parent to outbuf then ; : free-buf ( -- ) - outbuf if outbuf /outbuf dma-free 0 to outbuf then + outbuf if outbuf /outbuf " free-buffer" $call-parent 0 to outbuf then ; \ ======================================================================= @@ -143,27 +158,24 @@ : set-auth-mode ( amode -- ) to auth-mode ; headers -: marvel-link-up? ( -- flag ) driver-state ds-ready > ; - -' marvel-link-up? to link-up? +: link-up? ( -- flag ) driver-state ds-ready > ; \ ========================================================================= \ Firmware Command \ ========================================================================= struct - /fw-transport + 2 field >fw-cmd \ Start of command header 2 field >fw-len 2 field >fw-seq 2 field >fw-result dup constant /fw-cmd -dup /fw-transport - constant /fw-cmd-hdr \ Command header len (less /fw-transport) +dup constant /fw-cmd-hdr \ Command header len (less /fw-transport) 0 field >fw-data \ Command payload starts here drop : outbuf-out ( -- error? ) - outbuf dup >fw-len le-w@ /fw-transport + cmd-out + outbuf dup >fw-len le-w@ " cmd-out" $call-parent ; @@ -191,7 +203,6 @@ \ ========================================================================= struct - /fw-transport + 4 field >tx-stat 4 field >tx-ctrl 4 field >tx-offset @@ -211,7 +222,6 @@ constant /tx-hdr struct - /fw-transport + 1 field >tx14-bsstype 1 field >tx14-bss# 2 field >tx14-len @@ -241,7 +251,7 @@ dup outbuf >tx-len le-w! ( adr len ) tuck outbuf >tx-pkt-no-mesh swap move ( len ) - /tx-hdr-no-mesh /fw-transport - outbuf >tx-offset le-l! ( len ) \ Offset from >tx-stat field + /tx-hdr-no-mesh outbuf >tx-offset le-l! ( len ) \ Offset from >tx-stat field tx-ctrl outbuf >tx-ctrl le-l! ( len ) outbuf swap /tx-hdr-no-mesh + ( adr' len' ) @@ -253,7 +263,7 @@ dup outbuf >tx-len le-w! ( adr len ) tuck outbuf >tx-pkt swap move ( len ) - /tx-hdr /fw-transport - outbuf >tx-offset le-l! ( len ) \ Offset from >tx-stat field + /tx-hdr outbuf >tx-offset le-l! ( len ) \ Offset from >tx-stat field tx-ctrl outbuf >tx-ctrl le-l! ( len ) mesh-on? if 1 outbuf >tx-mesh-ttl c! then ( len ) @@ -270,7 +280,7 @@ dup outbuf >tx14-len le-w! ( adr len ) tuck outbuf >tx14-pkt swap move ( len ) - /tx14-hdr /fw-transport - outbuf >tx14-offset le-w! ( len ) \ Offset from >tx14-bsstype field + /tx14-hdr outbuf >tx14-offset le-w! ( len ) \ Offset from >tx14-bsstype field tx-ctrl outbuf >tx14-ctrl le-l! ( len ) outbuf swap /tx14-hdr + ( adr' len' ) @@ -287,7 +297,6 @@ \ Receive packet descriptor struct - /fw-transport + 2 field >rx-stat 1 field >rx-snr 1 field >rx-ctrl @@ -310,7 +319,6 @@ constant /rx-min struct - /fw-transport + 1 field >rx14-bsstype 1 field >rx14-bss# 2 field >rx14-len @@ -358,7 +366,7 @@ /rx-min < if drop true exit then ( adr ) \ Invalid packet: too small \ Go to the payload, skipping the descriptor header - dup dup >rx-offset le-l@ + /fw-transport + ( adr data-adr ) + dup dup >rx-offset le-l@ + ( adr data-adr ) swap >rx-len le-w@ ( data-adr data-len ) \ Remove snap header by moving the MAC addresses up @@ -374,7 +382,7 @@ \ Go to the payload, skipping the descriptor header >r ( r: adr ) - r@ r@ >rx14-offset le-w@ + /fw-transport + ( data-adr r: adr ) + r@ r@ >rx14-offset le-w@ + ( data-adr r: adr ) r@ >rx14-len le-w@ ( data-adr data-len r: adr ) r> >rx14-type c@ case ( data-adr data-len ) @@ -505,7 +513,7 @@ dup .cmd ( len cmd ) resp-wait-short to resp-wait ( len cmd ) outbuf /outbuf erase ( len cmd ) - outbuf /fw-transport + to x 0 to /x ( len cmd ) + outbuf to x 0 to /x ( len cmd ) ( len cmd ) +xw \ fw-cmd ( len ) /fw-cmd-hdr + +xw \ fw-len ( ) fw-seq++ +xw \ fw-seq ( ) @@ -530,9 +538,9 @@ 0 instance value backlog 0 value debug-tx-feedback? : process-ind ( adr len -- ) - drop - true to got-indicator? - 4 + le-l@ dup to last-event + drop ( adr ) + true to got-indicator? ( adr ) + le-l@ dup to last-event ( event-code ) dup h# 10000 u>= if ( event-code ) \ TX feedback from thin firmware backlog 1- 0 max to backlog ( event-code ) @@ -590,9 +598,8 @@ true to got-response? ( ) ; -: process-rx ( adr len -- ) - over packet-type case - \ Encoding must agree with packet-type +: process-rx ( adr len type -- ) + case 0 of process-request endof \ Response & request 1 of process-data endof \ Data 2 of process-ind endof \ Indication @@ -601,9 +608,9 @@ ; : check-for-rx ( -- ) - got-packet? if ( error | buf len 0 ) - 0= if 2dup vdump process-rx then ( ) - recycle-packet ( ) + " got-packet?" $call-parent if ( error | buf len type 0 ) + 0= if process-rx then ( ) + " recycle-packet" $call-parent ( ) then ( ) ; @@ -690,9 +697,8 @@ \ ========================================================================= : reset-wlan ( -- ) - " wlan-reset" evaluate driver-is-not-ready - reset-host-bus + " reset-host-bus" $call-parent ; : sleep ( -- ) reset-wlan ; : wake ( -- ) ; @@ -1692,7 +1698,6 @@ : ?reassociate ( -- ) driver-state ds-disconnected and if do-associate drop then ; -' ?reassociate to start-nic : disassociate ( mac$ -- ) dup 2+ h# 26 ( CMD_802_11_DISASSOCIATE ) prepare-cmd @@ -1794,7 +1799,7 @@ mac-adr$ mac-adr$ broadcast-mac$ 0 h# c0 set-802.11-header h# 0002 0 +pkt-data le-w! \ Reason code: auth no longer valid packet-buf /802.11-header 2 + wrap-802.11 ( adr len ) - data-out + " data-out" $call-parent r> set-tx-ctrl ; @@ -2100,18 +2105,6 @@ ?make-mac-address-property drop ; -: ?load-fw ( -- error? ) - driver-state ds-not-ready = if - load-all-fw if - ." Failed to download firmware" cr - true exit - then - ds-ready to driver-state - then - multifunction? if init-function then - ?make-mac-address-property -; - false instance value use-promiscuous? external @@ -2134,15 +2127,18 @@ repeat drop ; +\ Maybe handle this in parent's close method +: release-bus-resources ( -- ) " release-bus-resources" $call-parent ; + : open ( -- ok? ) my-args parse-args - set-parent-channel " " set-ssid \ Instance buffers aren't necessarily initially 0 + my-space " set-address" $call-parent \ Set SDIO function number if necessary opencount @ 0= if init-buf - driver-is-not-ready - /inbuf /outbuf setup-bus-io if free-buf false exit then - ?load-fw if release-bus-resources free-buf false exit then + ds-ready to driver-state + " multifunction?" $call-parent if init-function then + ?make-mac-address-property if release-bus-resources free-buf false exit then set-fw-params my-args " supplicant" $open-package to supplicant-ih supplicant-ih 0= if release-bus-resources free-buf false exit then @@ -2152,7 +2148,7 @@ link-up? 0= if do-associate 0= if free-buf false exit then then - start-nic + ?reassociate then then force-open? 0= if @@ -2171,10 +2167,9 @@ mesh-stop drop link-up? if target-mac$ deauthenticate then ['] 2drop to ?process-eapol - stop-nic mac-off supplicant-ih ?dup if close-package 0 to supplicant-ih then - multifunction? if shutdown-function then + " multifunction?" $call-parent if shutdown-function then release-bus-resources driver-is-not-ready then @@ -2185,20 +2180,20 @@ : write-force ( adr len -- actual ) tuck ( actual adr len ) wrap-ethernet ( actual adr' len' ) - data-out ( actual ) + " data-out" $call-parent ( actual ) ; : read-force ( adr len -- actual ) - got-packet? 0= if ( adr len ) + " got-packet?" $call-parent 0= if ( adr len ) 2drop -2 exit - then ( adr len [ error | buf actual 0 ] ) + then ( adr len [ error | buf actual type 0 ] ) if \ receive error ( adr len ) - recycle-packet ( adr len ) + " recycle-packet" $call-parent ( adr len ) 2drop -1 exit - then ( adr len buf actual ) + then ( adr len buf actual type ) - false to got-data? ( adr len buf actual ) + false to got-data? ( adr len buf actual type ) process-rx ( adr len ) got-data? if ( adr len ) @@ -2207,7 +2202,7 @@ 2drop -2 \ No data then ( actual ) - recycle-packet ( actual ) + " recycle-packet" $call-parent ( actual ) ; 0 instance value /packet @@ -2240,7 +2235,7 @@ " "(01 08 02 04 0b 16 0c 12 18 24 32 04 30 48 e0 ec)" ( tags-adr tags-len ) tuck 6 +pkt-data swap move ( tags-size ) packet-buf swap /802.11-header + 6 + wrap-802.11 ( adr len ) - data-out + " data-out" $call-parent ; : authenticate-reply ( -- ) @@ -2250,7 +2245,7 @@ 0 4 +pkt-data le-w! \ Status - okay packet-buf /802.11-header 6 + wrap-802.11 ( adr len ) - data-out + " data-out" $call-parent ; defer handle-data ' noop is handle-data @@ -2297,7 +2292,7 @@ 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 ) + " data-out" " $call-parent ( len ) throttle ; @@ -2339,7 +2334,7 @@ 0 ( adr 0 ) then ( adr ihandle|0 ) - dup 0= if ." Can't open obp-tftp support package" stop-nic abort then + dup 0= if ." Can't open obp-tftp support package" abort then ( adr ihandle ) >r @@ -2348,7 +2343,7 @@ throw ; -: reset ( -- flag ) reset-nic ; +: reset ( -- flag ) true ; : do-disassociate ( -- ) " target-mac$" $call-supplicant disassociate Modified: dev/mmc/sdhci/mv8686/common.fth ============================================================================== --- dev/mmc/sdhci/mv8686/common.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/mv8686/common.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -28,10 +28,6 @@ ; : /string ( adr len cnt -- adr+n len-n ) tuck - -rot + swap ; -create mac-adr 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, -6 constant /mac-adr -: mac-adr$ ( -- adr len ) mac-adr /mac-adr ; - : null$ ( -- adr len ) " " ; \ Big endian operations @@ -58,25 +54,6 @@ : vldump ( adr len -- ) debug? if " ldump" evaluate else 2drop then ; : vtype ( adr len -- ) debug? if type cr else 2drop then ; - -defer link-up? ( -- up? ) ' true to link-up? -defer reset-nic ( -- ) ' noop to reset-nic -defer start-nic ( -- ) ' noop to start-nic -defer stop-nic ( -- ) ' noop to stop-nic - -external -defer get-mac-address ( -- adr len ) ' mac-adr$ to get-mac-address -headers - -: max-frame-size ( -- size ) d# 1514 ; - -: property-or-abort ( name$ -- n ) - 2dup get-my-property if ( name$ ) - ." Can't find property " type cr stop-nic abort - then ( name$ value$ ) - 2swap 2drop decode-int nip nip ( n ) -; - : find-fw ( $ -- adr len ) over " rom:" comp if \ Not a dropin Modified: dev/mmc/sdhci/mv8686/fw8686.fth ============================================================================== --- dev/mmc/sdhci/mv8686/fw8686.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/mv8686/fw8686.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -6,6 +6,8 @@ \ Firmware download data structures \ ======================================================================= +0 value fw-buf + h# fedc constant FIRMWARE_READY fw-blksz 2 * 4 - constant /fw-tx @@ -21,7 +23,7 @@ 0 value fw-tx-len 0 value dn-retry -: fw-dn-blksz ( -- blksz ) host-f1-rd-base-0-reg 1 sdio-reg-w@ ; +: fw-dn-blksz ( -- blksz ) host-f1-rd-base-0-reg sdio-w@ ; : wait-for-fw-dn-blksz ( -- blksz ) \ Wait for the first non-zero value d# 5000 0 do fw-dn-blksz dup ?leave drop loop @@ -41,9 +43,9 @@ 0 to dn-idx 0 to dn-retry begin fw-len dn-idx - fw-tx-len min ( len ) - fw-adr dn-idx + outbuf 2 pick move ( len ) - outbuf over sdio-fw! <> if - 4 config-reg 1 sdio-reg! \ FN1 CFG = write iomem fail + fw-adr dn-idx + fw-buf 2 pick move ( len ) + fw-buf over sdio-fw! <> if + 4 config-reg sdio-b! \ FN1 CFG = write iomem fail then sdio-poll-dl-ready 0= if ." Download fw died" cr true exit then fw-dn-blksz ?dup 0= if false exit then @@ -73,7 +75,7 @@ fw-download-ok? 0= if true exit then mv8787? if - 2 config-reg 1 sdio-reg! \ Host power up + 2 config-reg sdio-b! \ Host power up then false ; @@ -84,14 +86,14 @@ begin sdio-poll-dl-ready 0= if true exit then fw-len dn-idx - /fw-tx min ( len ) - dup outbuf le-l! ( len ) - fw-adr dn-idx + outbuf 4 + 2 pick move ( len ) + dup fw-buf le-l! ( len ) + fw-adr dn-idx + fw-buf 4 + 2 pick move ( len ) dn-idx over + to dn-idx ( len ) - outbuf swap 4 + sdio-fw! drop ( ) + fw-buf swap 4 + sdio-fw! drop ( ) dn-idx fw-len >= until \ Write last EOF data - outbuf fw-blksz erase - outbuf fw-blksz sdio-fw! drop + fw-buf fw-blksz erase + fw-buf fw-blksz sdio-fw! drop false ; @@ -101,12 +103,14 @@ (download-helper) ; -: load-sdio-fw ( -- error? ) +: free-fw-buf ( -- ) fw-buf d# 2048 dma-free ; +: load-all-fw ( -- error? ) + d# 2048 dma-alloc to fw-buf helper? if wlan-helper find-fw dup if ( adr len ) 2dup download-helper ( adr len error? ) -rot free-mem ( error? ) - if true exit then ( ) + if free-fw-buf true exit then ( ) else ( adr len ) 2drop ( ) then ( ) @@ -118,8 +122,39 @@ else ( adr len ) 2drop true ( error? ) then ( error? ) + free-fw-buf ( error? ) +; + +false value fw-active? +: set-address ( function# -- ) + init-function + fw-active? 0= if + load-all-fw if + ." Marvell WLAN module firmware load failed" cr + abort + then + true to fw-active? + then + mv8787? if + card-rx-unit-reg sdio-b@ to rx-shift + then +; +: reset-host-bus ( -- ) " wlan-reset" evaluate false to fw-active? ; + +0 value open-count +: open ( -- flag ) + set-parent-channel + open-count if + true + else + setup-bus-io 0= + then ( okay? ) + dup if open-count 1+ to open-count then +; +: close ( -- ) + open-count 1 = if false to fw-active? then + open-count 1- 0 max to open-count ; -' load-sdio-fw to load-all-fw \ LICENSE_BEGIN \ Copyright (c) 2007 FirmWorks Modified: dev/mmc/sdhci/mv8686/loadpkg.fth ============================================================================== --- dev/mmc/sdhci/mv8686/loadpkg.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/mv8686/loadpkg.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -1,7 +1,24 @@ +" sdio" name fload ${BP}/dev/mmc/sdhci/mv8686/common.fth \ Ethernet common variables and routines fload ${BP}/dev/mmc/sdhci/mv8686/ring.fth \ Receive ring management fload ${BP}/dev/mmc/sdhci/mv8686/sdio.fth \ SDIO interface routines fload ${BP}/dev/mmc/sdhci/mv8686/mv8686.fth \ SDIO I/O interface for Marvell 8686 -fload ${BP}/dev/libertas.fth \ Marvell "Libertas" common code fload ${BP}/dev/mmc/sdhci/mv8686/fw8686.fth \ Marvell firmware download for SDIO -\ fload ${BP}/dev/mmc/sdhci/mv8686/wlan.fth \ External interface methods + +1 " #size-cells" integer-property +1 " #address-cells" integer-property +: decode-unit ( adr len -- phys ) push-hex $number if 0 then pop-base ; +: encode-unit ( phys -- adr len ) push-hex (u.) pop-base ; + +new-device +1 to my-space +my-space 1 reg +fload ${BP}/dev/libertas.fth \ Marvell "Libertas" common code +finish-device + +new-device +2 to my-space +my-space 1 reg +" bluetooth" name +fload ${BP}/dev/bluetooth/marvell-hci.fth \ Bluetooth driver +finish-device Modified: dev/mmc/sdhci/mv8686/mv8686.fth ============================================================================== --- dev/mmc/sdhci/mv8686/mv8686.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/mv8686/mv8686.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -4,8 +4,6 @@ headers hex -0 0 encode-bytes " fullmac" property - \ ======================================================================= \ Wireless environment variables \ wlan-fw e.g., rom:mv8686.bin, disk:\mv8686.bin @@ -29,44 +27,69 @@ 2 field >fw-type constant /fw-transport -: packet-type ( adr -- type ) - >fw-type le-w@ case - CMD_TYPE_CMD of 0 endof - CMD_TYPE_DATA of 1 endof - CMD_TYPE_EVENT of 2 endof - endcase +: bt-packet-len&type ( adr -- len type ) + /fw-transport - dup le-l@ h# ffffff and /fw-transport - swap 3 + c@ ; : cmd-out ( adr len -- error? ) - read-poll + /fw-transport negate /string ( adr' len' ) + read-poll ( len ) 2dup swap >fw-plen le-w! ( len ) CMD_TYPE_CMD 2 pick >fw-type le-w! ( len ) - - 2dup vdump ( adr len ) packet-out ( error? ) ; : data-out ( adr len -- ) - read-poll + /fw-transport negate /string ( adr' len' ) + read-poll ( adr len ) 2dup swap >fw-plen le-w! ( adr len ) CMD_TYPE_DATA 2 pick >fw-type le-w! ( adr len ) packet-out-async ; -: got-packet? ( -- false | error true | buf len 0 true ) - read-poll ( ) +: decode-header ( buf len -- dadr dlen 8686-type ) + drop ( buf ) + dup /fw-transport + swap ( dadr buf ) + dup >fw-plen le-w@ swap ( dadr dlen ) + >fw-type le-w@ case + CMD_TYPE_CMD of 0 endof + CMD_TYPE_DATA of 1 endof + CMD_TYPE_EVENT of 2 endof + endcase ( dadr dlen 8686-type ) +; +: got-packet? ( -- false | error true | buf len type 0 true ) + read-poll ( ) - get-queued? if ( buf len ) - 0 true ( buf len 0 true ) - else ( ) - false ( false ) + get-queued? if ( buf len ) + decode-header ( dadr dlen type ) + 0 true ( buf len 0 true ) + else ( ) + false ( false ) + then +; +: decode-bt-header ( buf len -- dadr dlen type ) + drop ( buf ) + \ SDIO specific header - length: byte[2:0], type: byte[3] + \ (HCI_COMMAND = 1, ACL_DATA = 2, SCO_DATA = 3, EVENT=4, 0xFE = Vendor) + dup /fw-transport + swap ( dadr buf ) + dup le-l@ h# ffffff and swap ( dadr dlen buf ) + 3 + c@ ( dadr dlen type ) +; + +: got-bt-packet? ( -- false | dadr dlen type true ) + read-poll ( ) + + get-queued? if ( buf len ) + decode-bt-header true ( dadr dlen type true ) + else ( ) + false ( false ) then ; : recycle-packet ( -- ) recycle-queued ; 0 value rca \ Relative card address -: set-parent-channel ( -- ) rca my-unit set-address ; +: set-parent-channel ( -- ) rca my-unit " set-address" $call-parent ; : release-bus-resources ( -- ) drain-queue detach-card ; @@ -75,20 +98,19 @@ ; : make-my-properties ( -- ) - get-address dup to rca + " get-address" $call-parent dup to rca encode-int " assigned-address" property ; -: setup-bus-io ( /inbuf /outbuf -- error? ) - 2drop +: setup-bus-io ( -- error? ) init-queue ?attach-card 0= if ." Failed to attach card" cr true exit then make-my-properties - init-device false ; -: reset-host-bus ( -- ) ; +: alloc-buffer ( len -- adr ) /fw-transport + dma-alloc ; +: free-buffer ( adr len -- ) /fw-transport negate /string dma-free ; \ LICENSE_BEGIN \ Copyright (c) 2009 FirmWorks Modified: dev/mmc/sdhci/mv8686/sdio.fth ============================================================================== --- dev/mmc/sdhci/mv8686/sdio.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/mv8686/sdio.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -4,14 +4,16 @@ hex headers -: sdio-reg@ ( reg# function# -- value ) " sdio-reg@" $call-parent ; -: sdio-reg! ( value reg# function# -- ) " sdio-reg!" $call-parent ; -: sdio-reg-w@ ( reg# function# -- w.value ) - 2dup sdio-reg@ -rot ( low reg# function# ) - swap 1+ swap sdio-reg@ ( low high ) - bwjoin ( w.value ) +0 instance value function# +0 instance value rx-shift + +: sdio-b@ ( reg# function# -- value ) function# " sdio-reg@" $call-parent ; +: sdio-b! ( value reg# function# -- ) function# " sdio-reg!" $call-parent ; +: sdio-w@ ( reg# -- w.value ) + dup sdio-b@ ( reg# low ) + swap 1+ sdio-b@ ( low high ) + bwjoin ( w.value ) ; -: sdio-w@ ( reg# -- w.value ) 1 sdio-reg-w@ ; false instance value multifunction? false instance value helper? @@ -26,7 +28,7 @@ : default-fw$ ( -- adr len ) fw-name-adr fw-name-len ; : set-default-fw$ ( adr len -- ) to fw-name-len to fw-name-adr ; -0 value ioport +0 instance value ioport d# 256 constant blksz \ Block size for data tx/rx d# 256 constant fw-blksz @@ -50,8 +52,8 @@ h# 6c constant card-misc-cfg-reg h# 60 constant card-fw-status0-reg \ h# 61 constant card-fw-status1-reg -\ h# 62 constant card-rx-len-reg -\ h# 63 constant card-rx-unit-reg +h# 62 constant card-rx-len-reg +h# 63 constant card-rx-unit-reg h# 78 constant ioport-reg : ?set-module-property ( adr len -- ) @@ -67,9 +69,9 @@ ; : mv8686-rx-ready? ( -- len ) - host-intstatus-reg 1 sdio-reg@ + host-intstatus-reg sdio-b@ dup 0= if exit then - dup invert 3 and host-intstatus-reg 1 sdio-reg! \ Clear UP_LD bit + dup invert 3 and host-intstatus-reg sdio-b! \ Clear UP_LD bit 1 and if sdio-fw-status@ else @@ -106,15 +108,32 @@ 2drop then ; + 0 instance value rx-port# 0 instance value wr-bitmap 0 instance value rd-bitmap +: bt-update-bitmaps ( -- len ) + card-status-reg sdio-b@ + dup 1 and if 1 to wr-bitmap then + 2 and if 1 to rd-bitmap then +; +: mv8787-bt-rx-ready? ( -- len ) + rd-bitmap if ( ) + 0 to rd-bitmap ( ) + card-rx-len-reg sdio-b@ rx-shift lshift ( len ) + \ XXX round up to multiple of blocksize ? Maybe sdhci already does it + else ( ) + bt-update-bitmaps ( ) + 0 ( len ) + then ( len ) +; + : update-bitmaps ( -- ) - host-intstatus-reg 1 sdio-reg@ + host-intstatus-reg sdio-b@ dup 2 and if wr-bitmap-reg sdio-w@ to wr-bitmap then 1 and if rd-bitmap-reg sdio-w@ to rd-bitmap then ; -: mv8787-rx-ready? ( -- len ) +: mv8787-wlan-rx-ready? ( -- len ) rd-bitmap dup if ( bitmap ) d# 16 0 do ( bitmap ) dup 1 and if ( bitmap ) @@ -129,6 +148,9 @@ update-bitmaps ( 0 ) then ; +: mv8787-rx-ready? ( -- len ) + function# 1 = if mv8787-wlan-rx-ready? else mv8787-bt-rx-ready? then +; : mv8787-get-ctrl-port ( -- n ) 0 @@ -168,8 +190,8 @@ h# 6c to card-misc-cfg-reg h# 60 to card-fw-status0-reg \ h# 61 to card-fw-status1-reg -\ h# 62 to card-rx-len-reg -\ h# 63 to card-rx-unit-reg + h# 62 to card-rx-len-reg + h# 63 to card-rx-unit-reg h# 78 to ioport-reg d# 256 to blksz d# 256 to fw-blksz @@ -183,6 +205,8 @@ true to multifunction? ; +: set-block-size ( n -- ) to blksz ; + : set-version ( -- error? ) " sdio-card-id" $call-parent case h# 02df9103 of use-mv8686 false endof @@ -195,14 +219,13 @@ : roundup-blksz ( n -- n' ) blksz 1- + blksz / blksz * ; -: set-address ( rca slot -- ) " set-address" $call-parent ; : get-address ( -- rca ) " get-address" $call-parent ; : attach-card ( -- ok? ) " attach-sdio-card" $call-parent ; : detach-card ( -- ) " detach-sdio-card" $call-parent ; : sdio-poll-dl-ready ( -- ready? ) false d# 100 0 do - card-status-reg 1 sdio-reg@ + card-status-reg sdio-b@ h# 9 tuck and = if drop true leave then d# 100 usec loop @@ -210,47 +233,51 @@ ; : sdio-fw! ( adr len -- actual ) - >r >r ioport 1 true r> r> fw-blksz false " r/w-ioblocks" $call-parent + >r >r ioport function# true r> r> fw-blksz false " r/w-ioblocks" $call-parent ; -: init-device ( -- ) - ioport-reg 3 bounds do i 1 sdio-reg@ loop \ Read the IO port - 0 bljoin to ioport +: init-function ( function# -- ) + 0 to function# ( function# ) - 7 0 sdio-reg@ h# 20 or 7 0 sdio-reg! \ Enable async interrupt mode + 1 over lshift 2 sdio-b! ( function# ) \ Enable IO function + 1 over lshift 1 or 4 sdio-b! ( function# ) \ Enable interrupts for function and card - 2 2 0 sdio-reg! \ Enable IO function 1 (2 = 1 << 1) - 3 4 0 sdio-reg! \ Enable interrupts (1) for function 1 (1 << 1) + 7 sdio-b@ h# 20 or 7 sdio-b! ( function# ) \ Enable async interrupt mode + + to function# + + ioport-reg 3 bounds do i sdio-b@ loop \ Read the IO port + 0 bljoin to ioport mv8787? if \ Set host interrupt reset to "read to clear" - host-int-rsr-reg 1 sdio-reg@ h# 3f or host-int-rsr-reg 1 sdio-reg! + host-int-rsr-reg sdio-b@ h# 3f or host-int-rsr-reg sdio-b! \ Set Dnld/upld to "auto reset" - card-misc-cfg-reg 1 sdio-reg@ h# 10 or card-misc-cfg-reg 1 sdio-reg! + card-misc-cfg-reg sdio-b@ h# 10 or card-misc-cfg-reg sdio-b! then \ Newer revisions of the 8787 firmware empirically require that this \ be enabled early, before firmware download. Older versions, and \ 8686 firmware, appear to be content with it either here or after \ firmware startup. - 3 host-int-mask-reg 1 sdio-reg! \ Enable upload (1) and download (2) + 3 host-int-mask-reg sdio-b! \ Enable upload (1) and download (2) ; : sdio-blocks@ ( adr len -- actual ) >r >r - rx-port# ioport + 1 true r> r> blksz true " r/w-ioblocks" $call-parent ( actual ) + rx-port# ioport + function# true r> r> blksz true " r/w-ioblocks" $call-parent ( actual ) ; \ : sdio-blocks! ( adr len -- actual ) -\ >r >r x-get-write-port ioport + 1 true r> r> blksz false " r/w-ioblocks" $call-parent +\ >r >r x-get-write-port ioport + function# true r> r> blksz false " r/w-ioblocks" $call-parent \ ; -\ 1 is the function number : (sdio-blocks!) ( adr len port# -- actual ) - ioport + -rot ( port# adr len ) - 1 true 2swap ( port# function# inc? adr len ) + ioport + -rot ( port# adr len ) + function# true 2swap ( port# function# inc? adr len ) blksz false " r/w-ioblocks" $call-parent ; +: sdio-blocks! ( adr len -- actual ) 0 (sdio-blocks!) ; \ 0 is the control port number : packet-out ( adr len -- error? ) tuck get-ctrl-port (sdio-blocks!) <> ; Modified: dev/mmc/sdhci/sdhci.fth ============================================================================== --- dev/mmc/sdhci/sdhci.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/mmc/sdhci/sdhci.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -1090,7 +1090,7 @@ cis@+ ( offset' tuple-code ) dup h# ff <> while ( offset tuple-code ) - \ Another potentially interesting tuples si h# 15 from which + \ Another potentially interesting tuple is h# 15 from which \ you can get strings naming the product. case h# 20 of parse-funcid endof Modified: dev/usb2/device/wlan/fw8388.fth ============================================================================== --- dev/usb2/device/wlan/fw8388.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/usb2/device/wlan/fw8388.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -84,11 +84,11 @@ : wait-cmd-fw-dl-ack ( -- acked? ) d# 100 0 do ( ) - got-packet? if ( error | buf len 0 ) + got-packet? if ( error | buf len type 0 ) if ( ) false ( acked? ) - else ( buf len ) - cmd-fw-dl-ok? ( acked? ) + else ( buf len type ) + drop cmd-fw-dl-ok? ( acked? ) then ( acked? ) recycle-packet ( acked? ) unloop exit @@ -99,12 +99,12 @@ ; : download-fw-init ( -- ) - outbuf /boot-cmd erase - boot-magic outbuf >boot-magic le-l! - cmd-fw-dl outbuf >boot-cmd c! + fw-buf /boot-cmd erase + boot-magic fw-buf >boot-magic le-l! + cmd-fw-dl fw-buf >boot-cmd c! 5 0 do - outbuf /boot-cmd packet-out drop + fw-buf /boot-cmd packet-out drop wait-cmd-fw-dl-ack if leave then loop ; @@ -118,8 +118,8 @@ : wait-fw-dl-ack ( -- ) d# 500 0 do ( ) - got-packet? if ( error | buf len 0 ) - 0= if process-dl-resp then ( ) + got-packet? if ( error | buf len tupe 0 ) + 0= if drop process-dl-resp then ( ) recycle-packet ( ) leave then ( ) @@ -130,11 +130,11 @@ : (download-fw) ( adr len -- ) bounds begin ( end start ) dl-seq++ \ Increment sequence number - dup outbuf /dl-header move \ Move header to outbuf - dl-seq outbuf >dl-seq le-l! \ Add sequence number to outbuf - dup /dl-header + outbuf >dl-data 2 pick >dl-len le-l@ dup >r move - \ Move payload to outbuf - outbuf r@ /dl-header + 4 + packet-out drop + dup fw-buf /dl-header move \ Move header to outbuf + dl-seq fw-buf >dl-seq le-l! \ Add sequence number to outbuf + dup /dl-header + fw-buf >dl-data 2 pick >dl-len le-l@ dup >r move + \ Move payload to fw-buf + fw-buf r@ /dl-header + 4 + packet-out drop \ Send command wait-fw-dl-ack \ Wait for ACK r> + /dl-header + \ Advance pointer @@ -179,13 +179,13 @@ false ; -: load-8388-fw ( -- error? ) +: load-all-fw ( -- error? ) + d# 2048 dma-alloc to fw-buf wlan-fw find-fw ( adr len ) dup if download-fw else 2drop true then + fw-buf d# 2048 dma-free ; -' load-8388-fw to load-all-fw - \ LICENSE_BEGIN \ Copyright (c) 2007 FirmWorks \ Modified: dev/usb2/device/wlan/usb8388.bth ============================================================================== --- dev/usb2/device/wlan/usb8388.bth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/usb2/device/wlan/usb8388.bth Mon Feb 25 09:34:36 2013 (r3569) @@ -13,9 +13,9 @@ fload ${BP}/dev/usb2/device/common.fth \ USB device driver common routines fload ${BP}/dev/usb2/device/wlan/common.fth \ Ethernet common variables and routines fload ${BP}/dev/usb2/device/wlan/usb8388.fth \ USB I/O interface for Marvell 8388 +fload ${BP}/dev/usb2/device/wlan/fw8388.fth \ Marvell firmware download for USB fload ${BP}/dev/libertas.fth \ Marvell "Libertas" common code \ fload ${BP}/dev/usb2/device/wlan/wlan.fth \ External interface methods -fload ${BP}/dev/usb2/device/wlan/fw8388.fth \ Marvell firmware download for USB end0 Modified: dev/usb2/device/wlan/usb8388.fth ============================================================================== --- dev/usb2/device/wlan/usb8388.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/usb2/device/wlan/usb8388.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -42,34 +42,45 @@ h# beef.face constant TYPE_USB_INDICATION : cmd-out ( adr len -- error? ) + /fw-transport negate /string ( adr' len' ) TYPE_USB_REQUEST 2 pick >fw-transport le-l! ( adr len ) 2dup vdump ( adr len ) packet-out ( error? ) ; : data-out ( adr len -- ) + /fw-transport negate /string ( adr' len' ) TYPE_USB_DATA 2 pick >fw-transport le-l! ( adr len ) packet-out-async ; -\ Translate the USB/8388 type codes into more abstract codes, which -\ happen to be the codes used by the 8686 -: packet-type ( adr -- type ) - >fw-transport le-l@ case +\ Translate the USB/8388 type codes into uniform code numbers +: decode-header ( buf len -- dadr dlen type ) + over le-l@ >r ( buf len r: usb-type ) + /fw-transport /string ( dadr dlen r: usb-type ) + r> case TYPE_USB_REQUEST of 0 endof TYPE_USB_DATA of 1 endof TYPE_USB_INDICATION of 2 endof - endcase + endcase ( dadr dlen type ) ; -: got-packet? ( -- false | error true | buf len 0 true ) bulk-in-ready? ; +: got-packet? ( -- false | error true | buf len type 0 true ) + bulk-in-ready? if ( error | buf len 0 ) + ?dup 0= if ( dadr dlen ) + decode-header 0 ( dadr dlen type 0 ) + then ( error | buf len 0 ) + else ( ) + false ( false ) + then ( false | error true | buf len 0 true ) +; : recycle-packet ( -- ) restart-bulk-in ; : end-out-ring ( -- ) " end-out-ring" $call-parent ; : set-parent-channel ( -- ) set-device device set-target ; -: setup-bus-io ( /inbuf /outbuf -- error? ) +: setup-bus-io ( -- error? ) reset? if configuration set-config if ." Failed to set USB configuration for wireless" cr @@ -77,14 +88,14 @@ then bulk-in-pipe bulk-out-pipe reset-bulk-toggles then - 4 bulk-out-pipe " begin-out-ring" $call-parent ( /inbuf ) - h# 40 bulk-in-pipe " begin-in-ring" $call-parent + d# 2048 4 bulk-out-pipe " begin-out-ring" $call-parent + d# 2048 h# 40 bulk-in-pipe " begin-in-ring" $call-parent false ; : release-bus-resources ( -- ) end-bulk-in end-out-ring ; -: reset-host-bus ( -- ) ; +: reset-host-bus ( -- ) " wlan-reset" evaluate ; 0 value vid 0 value pid @@ -97,6 +108,8 @@ ; init +XXX need open and close methods and open needs to call setup-bus-io +XXX need alloc-buffer and free-buffer method \ LICENSE_BEGIN \ Copyright (c) 2009 FirmWorks Modified: dev/usb2/device/wlan/wlan.fth ============================================================================== --- dev/usb2/device/wlan/wlan.fth Fri Feb 22 07:11:28 2013 (r3568) +++ dev/usb2/device/wlan/wlan.fth Mon Feb 25 09:34:36 2013 (r3569) @@ -124,14 +124,14 @@ : read-force ( adr len -- actual ) got-packet? 0= if ( adr len ) 2drop -2 exit - then ( adr len [ error | buf actual 0 ] ) + then ( adr len [ error | buf actual type 0 ] ) if \ receive error ( adr len ) recycle-packet ( adr len ) 2drop -1 exit - then ( adr len buf actual ) + then ( adr len buf actual type ) - false to got-data? ( adr len buf actual ) + false to got-data? ( adr len buf actual type ) process-rx ( adr len ) recycle-packet ( adr len )
1
0
0
0
[commit] r3568 - in cpu: arm/olpc x86/pc/olpc
by repository service
22 Feb '13
22 Feb '13
Author: quozl Date: Fri Feb 22 07:11:28 2013 New Revision: 3568 URL:
http://tracker.coreboot.org/trac/openfirmware/changeset/3568
Log: OLPC - add serial terminal, for built-in UART or for USB serial adapter Added: cpu/x86/pc/olpc/terminal.fth Modified: cpu/arm/olpc/build-fw.fth Modified: cpu/arm/olpc/build-fw.fth ============================================================================== --- cpu/arm/olpc/build-fw.fth Fri Feb 22 03:54:13 2013 (r3567) +++ cpu/arm/olpc/build-fw.fth Fri Feb 22 07:11:28 2013 (r3568) @@ -942,6 +942,7 @@ ; : enable-serial ; +fload ${BP}/cpu/x86/pc/olpc/terminal.fth \ Serial terminal emulator fload ${BP}/cpu/x86/pc/olpc/apt.fth \ Common developer utilities \ LICENSE_BEGIN Added: cpu/x86/pc/olpc/terminal.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/x86/pc/olpc/terminal.fth Fri Feb 22 07:11:28 2013 (r3568) @@ -0,0 +1,353 @@ +purpose: Serial terminal emulator +\ See license at end of file + +vocabulary serial-terminal +also serial-terminal definitions + +d# 1 value break-ms + +d# 80 constant /buf +/buf buffer: buf + + +\ queue implementation (adapted from dev/16550pkg/16550.fth) + +\ size of queues, approx 10 seconds at 115200 baud +d# 144000 constant /q + +struct + /n field >head + /n field >tail + /q field >qdata +constant /qstruct + +/qstruct buffer: read-q \ for reading from serial +/qstruct buffer: emit-q \ for showing to display + +: init-q ( q -- ) 0 over >head ! 0 swap >tail ! ; +: inc-q-ptr ( pointer-addr -- ) + dup @ ca1+ dup /q = if drop 0 then swap ! +; + +: enque ( new-entry q -- ) + >r + r@ >tail @ r@ >head @ 2dup > if - /q then 1- ( entry tail head ) + <> if r@ >qdata r@ >tail @ ca+ c! r@ >tail inc-q-ptr else drop then + r> drop +; + +: deque? ( q -- false | entry true ) + >r + r@ >head @ r@ >tail @ <> if + r@ >qdata r@ >head @ ca+ c@ r@ >head inc-q-ptr true + else + false + then + r> drop +; + +\ end of queue implementation + + +\ queued screen output + +: >q ( adr len ) + bounds do i c@ emit-q enque loop +; + +: q> ( -- ) + emit-q deque? if emit then +; + +\ end of queued screen output + + +\ serial device independent interface + +defer serial-open ( -- ) +defer serial-close ( -- ) +defer serial-emit ( key -- ) +defer serial-read ( -- adr len ) +defer serial-break ( -- ) + +\ end of serial device independent interface + + +\ internal serial device implementation + +\ interrupt enable register UART_IER, table 1993, page 1547 +: ier@ ( -- b ) h# 1 uart@ ; +: ier! ( b -- ) h# 1 uart! ; + +\ receiver data available interrupt enable +: ravie-on ( -- ) ier@ h# 1 or ier! ; +: ravie-off ( -- ) ier@ h# 1 invert and ier! ; + +\ line control register UART_LCR, table 1998, page 1554 +: ulcr@ ( -- b ) h# 3 uart@ ; +: ulcr! ( b -- ) h# 3 uart! ; + +\ set break +: sb-on ( -- ) ulcr@ h# 40 or ulcr! ; +: sb-off ( -- ) ulcr@ h# 40 invert and ulcr! ; + +\ modem control register UART_MCR, table 1999, page 1555 +: mcr@ ( -- b ) h# 4 uart@ ; +: mcr! ( b -- ) h# 4 uart! ; + +\ OUT2 signal control, enable UART interrupts +: out2-on ( -- ) mcr@ h# 8 or mcr! ; +: out2-off ( -- ) mcr@ h# 8 invert and mcr! ; + +: uart-break + begin uemit? until + sb-on + break-ms ms + sb-off +; + +\ IRQ number of console UART varies by platform +\ FIXME: find a better way to store or find these +[ifdef] olpc-cl1 + d# 4 value irq# +[then] +[ifdef] mmp2 + d# 24 value irq# +[then] +[ifdef] mmp3 + d# 28 value irq# +[then] + +\ serial interrupt handler for received data +: si ( -- ) ukey read-q enque ; + +\ enable serial interrupt +: esi + ['] si irq# interrupt-handler! + irq# enable-interrupt + ravie-on + out2-on +; + +\ disable serial interrupt +: dsi + out2-off + ravie-off + irq# disable-interrupt +; + +\ on XO-1.5, enable-serial disables the camera and adds the serial +\ instance handles to the multiplexor. on other models it is absent. +[ifndef] enable-serial \ present on XO-1.5 +: enable-serial ; +[then] + +false value uart-console-off? \ did we turn our uart console off? + +\ stop using the uart as console +\ (necessary to avoid noise from interconnected hosts) +: uart-console-off + fallback-out-ih remove-output + fallback-in-ih remove-input + true to uart-console-off? +; + +\ resume using the uart as console +: uart-console-on + uart-console-off? if + fallback-out-ih add-output + fallback-in-ih add-input + false to uart-console-off? + then +; + +: uart-open + enable-serial + uart-console-off + read-q init-q + esi +; + +: uart-close + dsi +; + +: uart-read ( -- adr len ) + buf 0 ( adr len ) + read-q deque? 0= if exit then ( adr len char ) + begin ( adr len char ) + >r 2dup + r> swap c! 1+ ( adr len' ) + dup /buf = if exit then ( adr len' ) + read-q deque? 0= + until ( adr len' ) +; + +: use-uart + uart-console-off + ['] uart-open to serial-open + ['] uart-close to serial-close + ['] uemit to serial-emit + ['] uart-read to serial-read + ['] uart-break to serial-break +; + +\ end of internal serial device implementation + + +\ USB serial device implementation + +0 value serial-ih + +: usb-open ( -- ) + " /usb/serial" open-dev dup 0= abort" can't open USB serial adapter" + to serial-ih +; + +: usb-close ( -- ) + serial-ih close-dev + 0 to serial-ih +; + +: usb-emit ( key -- ) + buf c! buf 1 " write" serial-ih $call-method drop +; + +: usb-read ( -- adr len ) + buf /buf " read" serial-ih $call-method ( len ) + dup -2 = if drop buf 0 exit then ( len ) + buf swap ( adr len ) +; + +: usb-break + " ftdi-break-on" serial-ih $call-method + 1 ms + " ftdi-8n1" serial-ih $call-method +; + +: use-usb + uart-console-on + ['] usb-open to serial-open + ['] usb-close to serial-close + ['] usb-emit to serial-emit + ['] usb-read to serial-read + ['] usb-break to serial-break +; + +use-usb + +\ end of USB serial device implementation + + +\ key bindings +\ (match the screen(1) defaults) +defer key-state ( key -- ) +defer key-state-default ( key -- ) + +: reset-key-state ['] key-state-default >data token@ to key-state ; + +: key-state-exit ( key -- ) serial-emit ; \ is not called + +: key-state-exit? ( -- exit? ) + ['] key-state >data token@ ['] key-state-exit = +; + +: key-state-c-a ( key -- ) \ list of recognised c-a sequences + case + 1 ( c-a ) of 1 serial-emit reset-key-state endof + 2 ( c-b ) of serial-break reset-key-state endof + [char] b of serial-break reset-key-state endof + [char] C of page reset-key-state endof + 4 ( c-d ) of ['] key-state-exit to key-state endof + [char] k of ['] key-state-exit to key-state endof + [char] K of ['] key-state-exit to key-state endof + ( default ) reset-key-state + endcase +; + +: key-state-run ( key -- ) + dup 1 = if ['] key-state-c-a to key-state drop exit then \ c-a + serial-emit ( ) +; + +' key-state-run to key-state-default + +\ end of key bindings + + +\ main program + +: serial-help-0 ( -- ) + green-letters + ." serial terminal:" cr + ." use c-a k to exit," cr + ." use c-a c-b to send break," cr + ." use c-a c-a to send a c-a." cr + cancel cr +; + +: serial-help-1 ( -- ) + cr green-letters ." serial terminal: stopped." cancel cr +; + +: outgoing ( -- ) \ data leaving this host + key? if key key-state then +; + +: incoming ( -- ) \ data arriving at this host + serial-read dup if >q else 2drop q> then +; + +: serial{ + emit-q init-q serial-open reset-key-state serial-help-0 +; + +: {serial} + begin outgoing incoming key-state-exit? until +; + +: }serial + serial-close serial-help-1 +; + +previous definitions also serial-terminal + +: serial serial{ {serial} }serial ; + +: serial-log ( "filename" -- ) + serial{ + safe-parse-word $create-file to log-ih + log-ih add-output + {serial} + log-ih remove-output + log-ih close-dev + }serial +; + +: use-uart use-uart ; +: use-usb use-usb ; + +previous + +\ LICENSE_BEGIN +\ Copyright (c) 2013 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
301
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
Results per page:
10
25
50
100
200