Commit graph

81 commits

Author SHA1 Message Date
Daniel Bevenius
f2ac14b86f Add WORD_LENGTH_32/HIGH_SPEED constants
This commit adds two constants which are intended to be used for setting
the `Word Length` and `High Speed` fields in the gSPR register
(address: 0x0000, bit: 0 and bit 4).

Currently, this field is being set by the following line:
```rust
        // 32bit, little endian.
        self.write32_swapped(REG_BUS_CTRL, 0x00010031).await;
```

Assuming that we are sending these bits using the gSPI write protocol
and using 16-bit word operation in little endian (which I think might
be the default) then the data bytes should be packed like this:
```
  +--+--+--+--+
  |D1|D0|D3|D2|
  +--+--+--+--+

val (hex):   0x00010031
val (bin):   00000000000000010000000000110001
rotated(16): 00000000001100010000000000000001
```

If we split val into bytes and rotated the bits we get:
```
Split into bytes:
   D3      D2        D1       D0
00000000 00000001 00000000 00110001

Rotate 16 and split into bytes:
   D1      D0        D3       D2
00000000 00110001 00000000 00000001
```
Looking at the write procotol it seems to me that the above will
indeed set the `Word Length` to 1 but will also set other values.
```
                                  Status enable (1=default)
   D1      D0        D3       D2  ↓
00000000 00110001 00000000 00000001
           ↑↑  ↑↑                 ↑
           ||  |Word Length (1=32-bit)
           ||  |
           ||  Endianess (0=Little)
           ||
           |High-speed mode (1=High speed (default))
           |
           Interrupt polarity (1=high (default))
```

This commit suggests adding the above mentioned constants for setting
the only the word length field and the high speed field.
2022-08-25 15:40:14 +02:00
Dario Nieuwenhuis
193124bed1
Merge pull request #8 from danbev/test-ro-rw-constants
Rename REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
2022-08-25 14:16:16 +02:00
Dario Nieuwenhuis
63806022f3
Merge pull request #7 from danbev/ai_comment
Add comment for AI constants
2022-08-25 14:14:48 +02:00
Daniel Bevenius
3826b4f713 Rename REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
This commit renames the REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
(Read-Only) which is the name used in the specification, section 4.2.3
Table 6.

It also adds a constant named REG_BUS_TEST_RW (Read-Write) to represent
the dummy register which the host can use to write data and read back
to check that the gSPI interface is working properly.
2022-08-25 09:13:26 +02:00
Daniel Bevenius
bb76a29ff1 Add comment for AI constants
This commit adds a comment about the AI_* constants.

The motivation for using this definition is from looking in the
following file:
https://github.com/seemoo-lab/bcm-public/blob/master/firmware_patching/examples/ioctl/bcmdhd/include/aidmp.h#L2
https://github.com/seemoo-lab/bcm-public/blob/master/firmware_patching/examples/ioctl/bcmdhd/include/aidmp.h#L307-L361
2022-08-24 15:58:44 +02:00
Dario Nieuwenhuis
9218aff498 Update Embassy. 2022-08-23 01:06:14 +02:00
Dario Nieuwenhuis
945449b10f Update Embassy. 2022-08-22 17:26:05 +02:00
Dario Nieuwenhuis
79c7be3fc6
Merge pull request #5 from danbev/clm-comments
Add comments about Country Locale Matrix (CLM)
2022-08-22 00:52:21 +02:00
Daniel Bevenius
6b4555a6a7 Add comments about Country Locale Matrix (CLM)
This commit add comments about what CLM stands for.

The motivation of this is that I think it helps understanding the code
for users who are new to the codebase (like me).
2022-08-20 10:52:45 +02:00
Dario Nieuwenhuis
f76815d642 Update Embassy. 2022-08-13 15:37:30 +02:00
Mattias Grönlund
3388b5cecf Improve data checks for VHD events
For some reason I got strange events on channel 1 (ASYNCEVENT_HEADER):

0.647329 WARN  unexpected ehternet type 0x0508, expected Qualcom ether type 0x886c

This patch improves the validation of BCD WHD events to minimize the
risk for panic.
2022-08-13 15:25:34 +02:00
Dario Nieuwenhuis
ddfbfa0132 move ioctl_id from State to Runner. 2022-08-13 15:11:17 +02:00
Dario Nieuwenhuis
5ef40acd1d Fix set iovar buffer length. 2022-07-22 00:05:39 +02:00
Dario Nieuwenhuis
92505f53e2 Get wifi credentials from envvars in example. 2022-07-21 23:50:40 +02:00
Dario Nieuwenhuis
726d68a706 Add status and instructions in README. 2022-07-17 00:34:41 +02:00
Dario Nieuwenhuis
54269a0761 Switch default log to debug.
Trace is very VRYY verbose.
2022-07-17 00:34:27 +02:00
Dario Nieuwenhuis
13c88a9ca3 Obtain the firmware blobs from the user instead of hardcoding magic flash addrs. 2022-07-17 00:33:30 +02:00
Dario Nieuwenhuis
4205eef3ec Fix iovar_get, unhardcode MAC addr. 2022-07-16 19:25:35 +02:00
Dario Nieuwenhuis
931e3d7ee0 Switch to 32bit SPI. 2022-07-16 18:06:57 +02:00
Dario Nieuwenhuis
7dfdea8797 Switch to embedded-hal SPI, GPIO traits. 2022-07-16 08:26:54 +02:00
Dario Nieuwenhuis
31410aa5b7 update rust nightly to match embassy. 2022-07-13 21:22:52 +02:00
Dario Nieuwenhuis
ce7353fba4 Hook up embassy-net. IT WORKS. 2022-07-12 07:52:16 +02:00
Dario Nieuwenhuis
f60407feb3 ITS DOING SOMETHING 2022-07-12 05:06:29 +02:00
Dario Nieuwenhuis
e1fd7dfc40 wpa2 join... still nothing. 2022-07-12 04:17:07 +02:00
Dario Nieuwenhuis
18b11e7417 check clmload_status. 2022-07-12 03:34:27 +02:00
Dario Nieuwenhuis
d96ad248b3 Add LICENSEs 2022-07-11 22:53:57 +02:00
Dario Nieuwenhuis
3ffdbd2ca3 stuff 2022-07-11 22:44:42 +02:00
Dario Nieuwenhuis
30b7800f9a add event printing, add join but not working yet. 2022-07-11 05:19:31 +02:00
Dario Nieuwenhuis
7ddcacac7b clm download, country config. 2022-07-11 03:07:39 +02:00
Dario Nieuwenhuis
069a57fcf8 async ioctls working. 2022-07-11 00:25:35 +02:00
Dario Nieuwenhuis
e560415fde 🌈 2022-07-10 19:45:26 +02:00