mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-09 20:00:40 +00:00
Updated part7 docs
This commit is contained in:
parent
88b45b66ab
commit
7d36b81242
1 changed files with 18 additions and 10 deletions
|
@ -70,7 +70,8 @@ Now the device is waiting. We need to send it the firmware bytes we included in
|
|||
```c
|
||||
void bt_loadfirmware()
|
||||
{
|
||||
if (!hciCommand(OGF_VENDOR, COMMAND_LOAD_FIRMWARE, empty, 0)) uart_writeText("loadFirmware() failed\n");
|
||||
volatile unsigned char empty[] = {};
|
||||
if (hciCommand(OGF_VENDOR, COMMAND_LOAD_FIRMWARE, empty, 0)) uart_writeText("loadFirmware() failed\n");
|
||||
|
||||
extern unsigned char _binary_BCM4345C0_hcd_start[];
|
||||
extern unsigned char _binary_BCM4345C0_hcd_size[];
|
||||
|
@ -78,15 +79,22 @@ void bt_loadfirmware()
|
|||
unsigned int c=0;
|
||||
unsigned int size = (long)&_binary_BCM4345C0_hcd_size;
|
||||
|
||||
while (c < size) {
|
||||
unsigned char opcodebytes[] = { _binary_BCM4345C0_hcd_start[c], _binary_BCM4345C0_hcd_start[c+1] };
|
||||
unsigned char length = _binary_BCM4345C0_hcd_start[c+2];
|
||||
unsigned char *data = &(_binary_BCM4345C0_hcd_start[c+3]);
|
||||
unsigned char opcodebytes[2];
|
||||
unsigned char length;
|
||||
unsigned char *data = &(_binary_BCM4345C0_hcd_start[0]);
|
||||
|
||||
if (!hciCommandBytes(opcodebytes, data, length)) {
|
||||
while (c < size) {
|
||||
opcodebytes[0] = *data;
|
||||
opcodebytes[1] = *(data+1);
|
||||
length = *(data+2);
|
||||
data += 3;
|
||||
|
||||
if (hciCommandBytes(opcodebytes, data, length)) {
|
||||
uart_writeText("Firmware data load failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
data += length;
|
||||
c += 3 + length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue