Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runner #14

Merged
merged 27 commits into from
Sep 13, 2023
Merged

Runner #14

merged 27 commits into from
Sep 13, 2023

Conversation

scottfeldman
Copy link
Collaborator

Opening a PR to make review easier. Based on goembassy branch.

Lots of stuff in here, but end result is we have LINK and Rx pkts!

The traces from Saleae for both ref and cyrw drivers shows exact[1] transactions up to and including wifi join.

[1] there are some transaction size diffs due to cyrw dealing in uint32s, so sizes are always multiples of 4 for cyrw.

scottfeldman and others added 22 commits September 10, 2023 01:17
Add lock to gaurd hw access during tx transactions.

Add check for atleast one credit before queuing tx transaction.  If a
credit isn't immediately available, we'll poll for an rx transaction to get
a credit to continue the tx transaction.

Adds two new functions: waitForCredit() and f2PacketAvail().  We'll re-use
both when the doIoctlSet|Get get re-worked in next commits.
Protect hw access by holding lock.

Check for a credit before send_ioctl.  If not credits available, poll
waiting for a credit so we can continue with send_ioctl.
Use cached status from previous cmd_read|cmd_write in check_status,
rather than reading status reg.
…events (yet)

offset/plen can be added later when needed for events with payload
(scan?)
cyrw/ioctl.go Outdated Show resolved Hide resolved
@soypat soypat merged commit c437a65 into gombassy Sep 13, 2023
@soypat
Copy link
Owner

soypat commented Sep 13, 2023

Merged! Thanks Scott!

soypat added a commit that referenced this pull request Sep 13, 2023
* begin adding rewrite based on new ref

* bus init finished

* firmware download complete, core disable failing

* rework cywanalyze

* firmware flash success

* most of transactions match, still failing

* init near identical to ref and working

* add ioctl.go

* blinky works

* add better async events

* small fix

* forgot to run stringer

* hard fault @ fmt.Printf(cdc_struct=%+vn, d.auxCDCHeader)

* checkpoint WIP on d.rx()

* keep working on clm load

* clean up a few things

* flesh out rxControl

* flesh out rxData

* tiden up compile errors

* continue work; correct CDCHeader endianness bug

* fix bug in bp_read; add Wifi

* better EventHeader type unmarshal; create debug.go

* fix OOB bug in log

* tidy up logging and some parts of code

* add way to print out low level gSPI transactions

* refactor whd; remove IoctlHeader (same as CDC)

* add comments

* Runner (#14)

* fix logic to match ref

* embed sync.Mutex directly in Device struct

* add polling go func to async service F2 pkts

* tx: add check for credit and protect with lock

Add lock to gaurd hw access during tx transactions.

Add check for atleast one credit before queuing tx transaction.  If a
credit isn't immediately available, we'll poll for an rx transaction to get
a credit to continue the tx transaction.

Adds two new functions: waitForCredit() and f2PacketAvail().  We'll re-use
both when the doIoctlSet|Get get re-worked in next commits.

* rework doIoctlSet|Get

Protect hw access by holding lock.

Check for a credit before send_ioctl.  If not credits available, poll
waiting for a credit so we can continue with send_ioctl.

* use cached status in check_status

Use cached status from previous cmd_read|cmd_write in check_status,
rather than reading status reg.

* BUG FIX: return correct payload from SDPCM packet

* BUG FIX: calculate correct offset/plen for IOCTL completion

* s/IOCTL_HEADER_LEN/CDC_HEADER_LEN/ to align with CDC header usage

* flesh out more of rxData

* rxEvent: process BDC hdr like ref; don't try to calc offset/plen for events (yet)

offset/plen can be added later when needed for events with payload
(scan?)

* fix country info to include full 12 bytes

* BUG FIX: s/GET/SET on setting antenna

* BUG FIX: stepping on iface in events

* BUG FIX: type on set_power_management

* move set_power_management call to end of control init

* add secrets.go for Wifi SSID/Passphrase

* git ignore secrets.go

* use secrets.go.template so secrets.go doesn't get checked back in

* fix secrets.go usage...oops

* get Wifi login working for wpa2

* fix data race in Device buffers by keeping locks around exported and async routines

* use pollForIoctl in waitForCredit

* replace other uses of d.spi.Status with s.status calls

* add netlinker interface and LED activity indicator to cmd/cyrw

* apply scott suggestions; apply a 'fix' to ethertype panic, seems to happen regularly

---------

Co-authored-by: soypat <graded.sp@gmail.com>

---------

Co-authored-by: Scott Feldman <sfeldma@gmail.com>
@soypat soypat deleted the runner branch September 13, 2023 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants