mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
add access to init script stored in progmem for avr
This commit is contained in:
parent
d1fef1900d
commit
b9fe9818fd
@ -52,6 +52,8 @@
|
|||||||
* - store init script in .fartext and use assembly code to read from there
|
* - store init script in .fartext and use assembly code to read from there
|
||||||
* - split into two arrays
|
* - split into two arrays
|
||||||
*
|
*
|
||||||
|
* Issues with AVR
|
||||||
|
* - Harvard architecture doesn't allow to store init script directly -> use avr-libc helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bt_control_cc256x.h"
|
#include "bt_control_cc256x.h"
|
||||||
@ -64,6 +66,10 @@
|
|||||||
#include "hal_compat.h"
|
#include "hal_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bt_control.h"
|
#include "bt_control.h"
|
||||||
|
|
||||||
|
|
||||||
@ -201,7 +207,15 @@ static int bt_control_cc256x_next_cmd(void *config, uint8_t *hci_cmd_buffer){
|
|||||||
int payload_len = hci_cmd_buffer[2];
|
int payload_len = hci_cmd_buffer[2];
|
||||||
FlashReadBlock(&hci_cmd_buffer[3], init_script_addr + init_script_offset, payload_len); // cmd payload
|
FlashReadBlock(&hci_cmd_buffer[3], init_script_addr + init_script_offset, payload_len); // cmd payload
|
||||||
|
|
||||||
#else
|
#elif defined (__AVR__)
|
||||||
|
|
||||||
|
// workaround: use memcpy_P to access init script in lower 64 kB of flash
|
||||||
|
memcpy_P(&hci_cmd_buffer[0], &cc256x_init_script[init_script_offset], 3);
|
||||||
|
init_script_offset += 3;
|
||||||
|
int payload_len = hci_cmd_buffer[2];
|
||||||
|
memcpy_P(&hci_cmd_buffer[3], &cc256x_init_script[init_script_offset], payload_len);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// use memcpy with pointer
|
// use memcpy with pointer
|
||||||
uint8_t * init_script_ptr = (uint8_t*) &cc256x_init_script[0];
|
uint8_t * init_script_ptr = (uint8_t*) &cc256x_init_script[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user