mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 02:42:33 +00:00
cc256x: provide btstack_chipset_cc256x_lmp_subversion(), validate in posix-h4 port
This commit is contained in:
parent
755bc58582
commit
ed5d91bab6
@ -50,9 +50,21 @@ extern "C" {
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "btstack_chipset.h"
|
#include "btstack_chipset.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure output power before HCI POWER_ON
|
||||||
|
*/
|
||||||
void btstack_chipset_cc256x_set_power(int16_t power_in_dB);
|
void btstack_chipset_cc256x_set_power(int16_t power_in_dB);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get chipset instance for CC256x series
|
||||||
|
*/
|
||||||
const btstack_chipset_t * btstack_chipset_cc256x_instance(void);
|
const btstack_chipset_t * btstack_chipset_cc256x_instance(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LMP Subversion of compile-time init script
|
||||||
|
*/
|
||||||
|
uint16_t btstack_chipset_cc256x_lmp_subversion(void);
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +33,14 @@ __attribute__((__progmem__))
|
|||||||
#endif
|
#endif
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
get_lmp_subversion = '''
|
||||||
|
const uint16_t {prefix}_init_script_lmp_subversion = {lmp_subversion};
|
||||||
|
|
||||||
|
uint16_t btstack_chipset_cc256x_lmp_subversion(void){{
|
||||||
|
return {prefix}_init_script_lmp_subversion;
|
||||||
|
}}
|
||||||
|
'''
|
||||||
|
|
||||||
data_indent = ' '
|
data_indent = ' '
|
||||||
|
|
||||||
def read_little_endian_16(f):
|
def read_little_endian_16(f):
|
||||||
@ -99,6 +107,7 @@ def append_calibration_sequence(additions, str_list, data_indent):
|
|||||||
str_list.append("0x01, 0x80, 0xfd, 0x06, 0x3c, 0xf0, 0x5f, 0x00, 0x00, 0x00,\n\n")
|
str_list.append("0x01, 0x80, 0xfd, 0x06, 0x3c, 0xf0, 0x5f, 0x00, 0x00, 0x00,\n\n")
|
||||||
return 20
|
return 20
|
||||||
|
|
||||||
|
|
||||||
def convert_bts(output_file, main_bts_file, bts_add_on, aka, lmp_subversion):
|
def convert_bts(output_file, main_bts_file, bts_add_on, aka, lmp_subversion):
|
||||||
array_name = 'cc256x'
|
array_name = 'cc256x'
|
||||||
|
|
||||||
@ -234,7 +243,7 @@ def convert_bts(output_file, main_bts_file, bts_add_on, aka, lmp_subversion):
|
|||||||
# if aka != "":
|
# if aka != "":
|
||||||
# fout.write( 'const char * {0}_init_script_aka = "{1}";\n'.format(array_name, aka))
|
# fout.write( 'const char * {0}_init_script_aka = "{1}";\n'.format(array_name, aka))
|
||||||
if lmp_subversion != 0:
|
if lmp_subversion != 0:
|
||||||
fout.write( 'const uint16_t %s_init_script_lmp_subversion = 0x%04x;\n' % (array_name, lmp_subversion))
|
fout.write( get_lmp_subversion.format(prefix = array_name, lmp_subversion = "0x%04x" % lmp_subversion))
|
||||||
part = 0
|
part = 0
|
||||||
size = 0
|
size = 0
|
||||||
for part_size in part_sizes:
|
for part_size in part_sizes:
|
||||||
@ -285,28 +294,37 @@ if len(sys.argv) == 4:
|
|||||||
add_on = sys.argv[2]
|
add_on = sys.argv[2]
|
||||||
output_file = sys.argv[-1]
|
output_file = sys.argv[-1]
|
||||||
|
|
||||||
# get AKA and lmp subversion from file names that include model name
|
# get AKA from file names that include model name
|
||||||
aka = ""
|
aka = ""
|
||||||
lmp_subversion = 0
|
lmp_subversion = 0
|
||||||
name_lower = main_bts.lower()
|
name_lower = main_bts.lower()
|
||||||
if 'cc2560_' in name_lower:
|
if 'cc2560_' in name_lower:
|
||||||
aka = "6.2.31"
|
aka = "6.2.31"
|
||||||
lmp_subversion = 0x191f
|
|
||||||
if 'cc2560a_' in name_lower or 'cc2564_' in name_lower:
|
if 'cc2560a_' in name_lower or 'cc2564_' in name_lower:
|
||||||
aka = "6.6.15"
|
aka = "6.6.15"
|
||||||
lmp_subversion = 0x1B0F
|
|
||||||
if 'cc2560b_' in name_lower or 'cc2564b_' in name_lower:
|
if 'cc2560b_' in name_lower or 'cc2564b_' in name_lower:
|
||||||
aka = "6.7.16"
|
aka = "6.7.16"
|
||||||
lmp_subversion = 0x1B90
|
|
||||||
if 'cc2564c_' in name_lower:
|
if 'cc2564c_' in name_lower:
|
||||||
aka = "6.12.26"
|
aka = "6.12.26"
|
||||||
lmp_subversion = 0x9a1a
|
|
||||||
|
|
||||||
# use AKA from .bts file that it
|
# use AKA from .bts file that it
|
||||||
name_parts = re.match('.*TIInit_(\d*\.\d*\.\d*).*.bts', main_bts)
|
name_parts = re.match('.*TIInit_(\d*\.\d*\.\d*).*.bts', main_bts)
|
||||||
if name_parts:
|
if name_parts:
|
||||||
aka = name_parts.group(1)
|
aka = name_parts.group(1)
|
||||||
|
|
||||||
|
# get lmp subversion from AKA
|
||||||
|
lmp_subversion_for_aka = {
|
||||||
|
'6.2.31' : 0x191f,
|
||||||
|
'6.6.15' : 0x1B0F,
|
||||||
|
'6.7.16' : 0x1B90,
|
||||||
|
'6.12.26' : 0x9a1a
|
||||||
|
}
|
||||||
|
|
||||||
|
if aka in lmp_subversion_for_aka:
|
||||||
|
lmp_subversion = lmp_subversion_for_aka[aka]
|
||||||
|
|
||||||
|
# print summary
|
||||||
|
|
||||||
print ("Main file: %s"% main_bts)
|
print ("Main file: %s"% main_bts)
|
||||||
if add_on != "":
|
if add_on != "":
|
||||||
print ("Add-on file: %s" % add_on)
|
print ("Add-on file: %s" % add_on)
|
||||||
|
@ -159,6 +159,12 @@ static void local_version_information_handler(uint8_t * packet){
|
|||||||
break;
|
break;
|
||||||
case COMPANY_ID_TEXAS_INSTRUMENTS_INC:
|
case COMPANY_ID_TEXAS_INSTRUMENTS_INC:
|
||||||
printf("Texas Instruments - CC256x compatible chipset.\n");
|
printf("Texas Instruments - CC256x compatible chipset.\n");
|
||||||
|
if (lmp_subversion != btstack_chipset_cc256x_lmp_subversion()){
|
||||||
|
printf("Error: LMP Subversion does not match initscript! ");
|
||||||
|
printf("Your initscripts is for %s chipset\n", btstack_chipset_cc256x_lmp_subversion() < lmp_subversion ? "an older" : "a newer");
|
||||||
|
printf("Please update Makefile to include the appropriate bluetooth_init_cc256???.c file\n");
|
||||||
|
exit(10);
|
||||||
|
}
|
||||||
use_fast_uart();
|
use_fast_uart();
|
||||||
hci_set_chipset(btstack_chipset_cc256x_instance());
|
hci_set_chipset(btstack_chipset_cc256x_instance());
|
||||||
#ifdef ENABLE_EHCILL
|
#ifdef ENABLE_EHCILL
|
||||||
@ -166,6 +172,7 @@ static void local_version_information_handler(uint8_t * packet){
|
|||||||
#else
|
#else
|
||||||
printf("eHCILL disable.\n");
|
printf("eHCILL disable.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case COMPANY_ID_BROADCOM_CORPORATION:
|
case COMPANY_ID_BROADCOM_CORPORATION:
|
||||||
printf("Broadcom - using BCM driver.\n");
|
printf("Broadcom - using BCM driver.\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user