same ol BT_CTRL_REG_ADDR = 8fc0f42a error
This commit is contained in:
parent
6a4300993c
commit
bd3335c127
@ -18,23 +18,15 @@ pub(crate) async fn upload_bluetooth_firmware<PWR: OutputPin, SPI: SpiBusCyw43>(
|
||||
firmware_offsets: &[(u32, usize)],
|
||||
firmware: &[u8],
|
||||
) {
|
||||
assert!(firmware.len() == 5952);
|
||||
// read version
|
||||
let version_length = firmware[0];
|
||||
let _version = &firmware[1..=version_length as usize];
|
||||
// skip version + 1 extra byte as per cybt_shared_bus_driver.c
|
||||
let firmware = &firmware[version_length as usize + 2..];
|
||||
// buffer
|
||||
let mut aligned_data_buffer: [u8; 0x100] = [0; 0x100];
|
||||
// structs
|
||||
let mut pointer = 0;
|
||||
for (index, &(dest_addr, num_fw_bytes)) in firmware_offsets.iter().enumerate() {
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
let fw_bytes = &firmware[(pointer)..(pointer + num_fw_bytes)];
|
||||
assert!(fw_bytes.len() == num_fw_bytes);
|
||||
//debug!("index = {}/{} dest_addr = {:08x} num_fw_bytes = {} fw_bytes = {:02x}", index, firmware_offsets.len(), dest_addr, num_fw_bytes, fw_bytes);
|
||||
debug!("index = {}/{} dest_addr = {:08x} num_fw_bytes = {} pointer = {}", index, firmware_offsets.len(), dest_addr, num_fw_bytes, pointer);
|
||||
assert!(firmware.len() == 5952);
|
||||
//debug!("index = {}/{} dest_addr = {:08x} num_fw_bytes = {} pointer = {}", index, firmware_offsets.len(), dest_addr, num_fw_bytes, pointer);
|
||||
let mut dest_start_addr = dest_addr;
|
||||
let mut aligned_data_buffer_index: usize = 0;
|
||||
// pad start
|
||||
@ -158,7 +150,6 @@ pub(crate) async fn bt_set_intr<PWR: OutputPin, SPI: SpiBusCyw43>(bus: &mut Bus<
|
||||
}
|
||||
|
||||
pub(crate) async fn init_bluetooth<PWR: OutputPin, SPI: SpiBusCyw43>(bus: &mut Bus<PWR, SPI>, firmware_offsets: &[(u32, usize)], firmware: &[u8]) {
|
||||
assert!(firmware.len() == 5952);
|
||||
bus.bp_write32(CHIP.bluetooth_base_address + BT2WLAN_PWRUP_ADDR, BT2WLAN_PWRUP_WAKE)
|
||||
.await;
|
||||
upload_bluetooth_firmware(bus, firmware_offsets, firmware).await;
|
||||
|
@ -226,7 +226,6 @@ where
|
||||
|
||||
let mut runner = Runner::new(ch_runner, Bus::new(pwr, spi), &state.ioctl_state, &state.events);
|
||||
|
||||
assert!(bluetooth_firmware.len() == 5952);
|
||||
runner.init(firmware, bluetooth_firmware_offsets, bluetooth_firmware).await;
|
||||
|
||||
(
|
||||
|
@ -74,8 +74,6 @@ where
|
||||
}
|
||||
|
||||
pub(crate) async fn init(&mut self, firmware: &[u8], bluetooth_firmware_offsets: &[(u32, usize)], bluetooth_firmware: &[u8]) {
|
||||
assert!(bluetooth_firmware.len() == 5952);
|
||||
|
||||
self.bus.init().await;
|
||||
|
||||
// Init ALP (Active Low Power) clock
|
||||
@ -118,6 +116,9 @@ where
|
||||
debug!("loading fw");
|
||||
self.bus.bp_write(ram_addr, firmware).await;
|
||||
|
||||
debug!("loading bluetooth fw");
|
||||
bluetooth::init_bluetooth(&mut self.bus, bluetooth_firmware_offsets, bluetooth_firmware).await;
|
||||
|
||||
debug!("loading nvram");
|
||||
// Round up to 4 bytes.
|
||||
let nvram_len = (NVRAM.len() + 3) / 4 * 4;
|
||||
@ -197,10 +198,6 @@ where
|
||||
while self.bus.read8(FUNC_BACKPLANE, REG_BACKPLANE_CHIP_CLOCK_CSR).await & 0x80 == 0 {}
|
||||
debug!("clock ok");
|
||||
|
||||
debug!("loading bluetooth fw");
|
||||
assert!(bluetooth_firmware.len() == 5952);
|
||||
bluetooth::init_bluetooth(&mut self.bus, bluetooth_firmware_offsets, bluetooth_firmware).await;
|
||||
|
||||
#[cfg(feature = "firmware-logs")]
|
||||
self.log_init().await;
|
||||
|
||||
|
@ -33,7 +33,6 @@ async fn main(spawner: Spawner) {
|
||||
let p = embassy_rp::init(Default::default());
|
||||
let bluetooth_firmware_offsets = &cyw43_firmware::BLUETOOTH_FIRMWARE_OFFSETS;
|
||||
let bluetooth_firmware = &cyw43_firmware::BLUETOOTH_FIRMWARE;
|
||||
defmt::assert!(bluetooth_firmware.len() == 5952);
|
||||
let fw = include_bytes!("../../../../cyw43-firmware/43439A0.bin");
|
||||
let clm = include_bytes!("../../../../cyw43-firmware/43439A0_clm.bin");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user